⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmpupil.vb

📁 An example to accompany PCW March 2004 Visual Programming Hands On. To use, open the solution in
💻 VB
字号:
Public Class frmPupil
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
	Friend WithEvents btnClose As System.Windows.Forms.Button
	Friend WithEvents Label1 As System.Windows.Forms.Label
	Friend WithEvents Label2 As System.Windows.Forms.Label
	Friend WithEvents Label3 As System.Windows.Forms.Label
	Friend WithEvents Label4 As System.Windows.Forms.Label
	Friend WithEvents Label5 As System.Windows.Forms.Label
	Friend WithEvents Label6 As System.Windows.Forms.Label
	Friend WithEvents Label7 As System.Windows.Forms.Label
	Friend WithEvents Label8 As System.Windows.Forms.Label
	Friend WithEvents txtFirstName As System.Windows.Forms.TextBox
	Friend WithEvents txtCounty As System.Windows.Forms.TextBox
	Friend WithEvents txtTown As System.Windows.Forms.TextBox
	Friend WithEvents txtAddress2 As System.Windows.Forms.TextBox
	Friend WithEvents txtAddress1 As System.Windows.Forms.TextBox
	Friend WithEvents txtLastName As System.Windows.Forms.TextBox
	Friend WithEvents txtNotes As System.Windows.Forms.TextBox
	Friend WithEvents txtpostcode As System.Windows.Forms.TextBox
	Friend WithEvents btnSave As System.Windows.Forms.Button
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		Me.btnClose = New System.Windows.Forms.Button
		Me.Label1 = New System.Windows.Forms.Label
		Me.Label2 = New System.Windows.Forms.Label
		Me.Label3 = New System.Windows.Forms.Label
		Me.Label4 = New System.Windows.Forms.Label
		Me.Label5 = New System.Windows.Forms.Label
		Me.Label6 = New System.Windows.Forms.Label
		Me.Label7 = New System.Windows.Forms.Label
		Me.Label8 = New System.Windows.Forms.Label
		Me.txtFirstName = New System.Windows.Forms.TextBox
		Me.txtCounty = New System.Windows.Forms.TextBox
		Me.txtpostcode = New System.Windows.Forms.TextBox
		Me.txtTown = New System.Windows.Forms.TextBox
		Me.txtAddress2 = New System.Windows.Forms.TextBox
		Me.txtAddress1 = New System.Windows.Forms.TextBox
		Me.txtLastName = New System.Windows.Forms.TextBox
		Me.txtNotes = New System.Windows.Forms.TextBox
		Me.btnSave = New System.Windows.Forms.Button
		Me.SuspendLayout()
		'
		'btnClose
		'
		Me.btnClose.Location = New System.Drawing.Point(292, 288)
		Me.btnClose.Name = "btnClose"
		Me.btnClose.Size = New System.Drawing.Size(96, 28)
		Me.btnClose.TabIndex = 9
		Me.btnClose.Text = "Close"
		'
		'Label1
		'
		Me.Label1.Location = New System.Drawing.Point(12, 12)
		Me.Label1.Name = "Label1"
		Me.Label1.Size = New System.Drawing.Size(92, 24)
		Me.Label1.TabIndex = 1
		Me.Label1.Text = "First Name"
		'
		'Label2
		'
		Me.Label2.Location = New System.Drawing.Point(12, 40)
		Me.Label2.Name = "Label2"
		Me.Label2.Size = New System.Drawing.Size(92, 24)
		Me.Label2.TabIndex = 2
		Me.Label2.Text = "Last Name"
		'
		'Label3
		'
		Me.Label3.Location = New System.Drawing.Point(12, 68)
		Me.Label3.Name = "Label3"
		Me.Label3.Size = New System.Drawing.Size(92, 24)
		Me.Label3.TabIndex = 3
		Me.Label3.Text = "Address 1"
		'
		'Label4
		'
		Me.Label4.Location = New System.Drawing.Point(12, 96)
		Me.Label4.Name = "Label4"
		Me.Label4.Size = New System.Drawing.Size(92, 24)
		Me.Label4.TabIndex = 4
		Me.Label4.Text = "Address 2"
		'
		'Label5
		'
		Me.Label5.Location = New System.Drawing.Point(12, 124)
		Me.Label5.Name = "Label5"
		Me.Label5.Size = New System.Drawing.Size(92, 24)
		Me.Label5.TabIndex = 5
		Me.Label5.Text = "Town"
		'
		'Label6
		'
		Me.Label6.Location = New System.Drawing.Point(12, 208)
		Me.Label6.Name = "Label6"
		Me.Label6.Size = New System.Drawing.Size(92, 24)
		Me.Label6.TabIndex = 6
		Me.Label6.Text = "Notes"
		'
		'Label7
		'
		Me.Label7.Location = New System.Drawing.Point(12, 180)
		Me.Label7.Name = "Label7"
		Me.Label7.Size = New System.Drawing.Size(92, 24)
		Me.Label7.TabIndex = 7
		Me.Label7.Text = "Postcode"
		'
		'Label8
		'
		Me.Label8.Location = New System.Drawing.Point(12, 152)
		Me.Label8.Name = "Label8"
		Me.Label8.Size = New System.Drawing.Size(92, 24)
		Me.Label8.TabIndex = 8
		Me.Label8.Text = "County"
		'
		'txtFirstName
		'
		Me.txtFirstName.Location = New System.Drawing.Point(116, 12)
		Me.txtFirstName.Name = "txtFirstName"
		Me.txtFirstName.Size = New System.Drawing.Size(204, 20)
		Me.txtFirstName.TabIndex = 0
		Me.txtFirstName.Text = "TextBox1"
		'
		'txtCounty
		'
		Me.txtCounty.Location = New System.Drawing.Point(116, 152)
		Me.txtCounty.Name = "txtCounty"
		Me.txtCounty.Size = New System.Drawing.Size(204, 20)
		Me.txtCounty.TabIndex = 5
		Me.txtCounty.Text = "TextBox2"
		'
		'txtpostcode
		'
		Me.txtpostcode.Location = New System.Drawing.Point(116, 180)
		Me.txtpostcode.Name = "txtpostcode"
		Me.txtpostcode.Size = New System.Drawing.Size(204, 20)
		Me.txtpostcode.TabIndex = 6
		Me.txtpostcode.Text = "TextBox3"
		'
		'txtTown
		'
		Me.txtTown.Location = New System.Drawing.Point(116, 120)
		Me.txtTown.Name = "txtTown"
		Me.txtTown.Size = New System.Drawing.Size(204, 20)
		Me.txtTown.TabIndex = 4
		Me.txtTown.Text = "TextBox4"
		'
		'txtAddress2
		'
		Me.txtAddress2.Location = New System.Drawing.Point(116, 96)
		Me.txtAddress2.Name = "txtAddress2"
		Me.txtAddress2.Size = New System.Drawing.Size(204, 20)
		Me.txtAddress2.TabIndex = 3
		Me.txtAddress2.Text = "TextBox5"
		'
		'txtAddress1
		'
		Me.txtAddress1.Location = New System.Drawing.Point(116, 68)
		Me.txtAddress1.Name = "txtAddress1"
		Me.txtAddress1.Size = New System.Drawing.Size(204, 20)
		Me.txtAddress1.TabIndex = 2
		Me.txtAddress1.Text = "TextBox6"
		'
		'txtLastName
		'
		Me.txtLastName.Location = New System.Drawing.Point(116, 40)
		Me.txtLastName.Name = "txtLastName"
		Me.txtLastName.Size = New System.Drawing.Size(204, 20)
		Me.txtLastName.TabIndex = 1
		Me.txtLastName.Text = "TextBox7"
		'
		'txtNotes
		'
		Me.txtNotes.Location = New System.Drawing.Point(116, 208)
		Me.txtNotes.Multiline = True
		Me.txtNotes.Name = "txtNotes"
		Me.txtNotes.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
		Me.txtNotes.Size = New System.Drawing.Size(272, 68)
		Me.txtNotes.TabIndex = 7
		Me.txtNotes.Text = "TextBox1"
		'
		'btnSave
		'
		Me.btnSave.Location = New System.Drawing.Point(196, 288)
		Me.btnSave.Name = "btnSave"
		Me.btnSave.Size = New System.Drawing.Size(88, 28)
		Me.btnSave.TabIndex = 8
		Me.btnSave.Text = "Save"
		'
		'frmPupil
		'
		Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
		Me.ClientSize = New System.Drawing.Size(404, 326)
		Me.Controls.Add(Me.btnSave)
		Me.Controls.Add(Me.txtNotes)
		Me.Controls.Add(Me.txtLastName)
		Me.Controls.Add(Me.txtAddress1)
		Me.Controls.Add(Me.txtAddress2)
		Me.Controls.Add(Me.txtTown)
		Me.Controls.Add(Me.txtpostcode)
		Me.Controls.Add(Me.txtCounty)
		Me.Controls.Add(Me.txtFirstName)
		Me.Controls.Add(Me.Label8)
		Me.Controls.Add(Me.Label7)
		Me.Controls.Add(Me.Label6)
		Me.Controls.Add(Me.Label5)
		Me.Controls.Add(Me.Label4)
		Me.Controls.Add(Me.Label3)
		Me.Controls.Add(Me.Label2)
		Me.Controls.Add(Me.Label1)
		Me.Controls.Add(Me.btnClose)
		Me.Name = "frmPupil"
		Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
		Me.Text = "Pupil detail"
		Me.ResumeLayout(False)

	End Sub

#End Region

	Dim dsPupil As DataSet

	Friend MainForm As frmMain

	Public Sub LoadData(ByVal ds As DataSet)
		Me.dsPupil = ds

		Me.txtAddress1.DataBindings.Add(New Binding("Text", ds, "pupils.address1"))
		Me.txtAddress2.DataBindings.Add(New Binding("Text", ds, "pupils.address2"))
		Me.txtFirstName.DataBindings.Add(New Binding("Text", ds, "pupils.firstname"))
		Me.txtLastName.DataBindings.Add(New Binding("Text", ds, "pupils.lastname"))
		Me.txtTown.DataBindings.Add(New Binding("Text", ds, "pupils.Town"))
		Me.txtpostcode.DataBindings.Add(New Binding("Text", ds, "pupils.Postcode"))
		Me.txtCounty.DataBindings.Add(New Binding("Text", ds, "pupils.county"))
		Me.txtNotes.DataBindings.Add(New Binding("Text", ds, "pupils.Notes"))
		'
	End Sub

	Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
		Me.Close()
		Me.Dispose()
	End Sub

	Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
		BindingContext(dsPupil, "pupils").EndCurrentEdit()
		SchoolData.SchoolData.DataModule.SavePupil(dsPupil)

		'call LoadData on main form to refresh grid
		MainForm.LoadData()

		Me.BringToFront()

	End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -