📄 frmcustomer.vb
字号:
Public Class frmCustomer
Inherits System.Windows.Forms.Form
Private objCargo As New Cargo()
#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
Friend WithEvents txtEmail As System.Windows.Forms.TextBox
Friend WithEvents txtID As System.Windows.Forms.TextBox
Friend WithEvents lblEmail As System.Windows.Forms.Label
Friend WithEvents lblID As System.Windows.Forms.Label
Friend WithEvents txtAddress As System.Windows.Forms.TextBox
Friend WithEvents lblAddress As System.Windows.Forms.Label
Friend WithEvents lstCustomers As System.Windows.Forms.ListBox
Friend WithEvents lblCompany As System.Windows.Forms.Label
Friend WithEvents txtCompany As System.Windows.Forms.TextBox
'Required by the Windows Form Designer
Private components As System.ComponentModel.Container
'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.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.txtEmail = New System.Windows.Forms.TextBox()
Me.txtID = New System.Windows.Forms.TextBox()
Me.lblEmail = New System.Windows.Forms.Label()
Me.lblID = New System.Windows.Forms.Label()
Me.txtAddress = New System.Windows.Forms.TextBox()
Me.lblAddress = New System.Windows.Forms.Label()
Me.lstCustomers = New System.Windows.Forms.ListBox()
Me.lblCompany = New System.Windows.Forms.Label()
Me.txtCompany = New System.Windows.Forms.TextBox()
Me.SuspendLayout()
'
'txtEmail
'
Me.txtEmail.Location = New System.Drawing.Point(216, 144)
Me.txtEmail.Name = "txtEmail"
Me.txtEmail.Size = New System.Drawing.Size(200, 20)
Me.txtEmail.TabIndex = 2
Me.txtEmail.Text = ""
'
'txtID
'
Me.txtID.Location = New System.Drawing.Point(216, 32)
Me.txtID.Name = "txtID"
Me.txtID.Size = New System.Drawing.Size(200, 20)
Me.txtID.TabIndex = 2
Me.txtID.Text = ""
'
'lblEmail
'
Me.lblEmail.Location = New System.Drawing.Point(216, 120)
Me.lblEmail.Name = "lblEmail"
Me.lblEmail.TabIndex = 1
Me.lblEmail.Text = "Email"
'
'lblID
'
Me.lblID.Location = New System.Drawing.Point(216, 8)
Me.lblID.Name = "lblID"
Me.lblID.TabIndex = 1
Me.lblID.Text = "ID"
'
'txtAddress
'
Me.txtAddress.Location = New System.Drawing.Point(216, 200)
Me.txtAddress.Multiline = True
Me.txtAddress.Name = "txtAddress"
Me.txtAddress.Size = New System.Drawing.Size(200, 32)
Me.txtAddress.TabIndex = 2
Me.txtAddress.Text = ""
'
'lblAddress
'
Me.lblAddress.Location = New System.Drawing.Point(216, 176)
Me.lblAddress.Name = "lblAddress"
Me.lblAddress.TabIndex = 1
Me.lblAddress.Text = "Address"
'
'lstCustomers
'
Me.lstCustomers.Location = New System.Drawing.Point(8, 8)
Me.lstCustomers.Name = "lstCustomers"
Me.lstCustomers.Size = New System.Drawing.Size(192, 225)
Me.lstCustomers.TabIndex = 0
'
'lblCompany
'
Me.lblCompany.Location = New System.Drawing.Point(216, 64)
Me.lblCompany.Name = "lblCompany"
Me.lblCompany.TabIndex = 1
Me.lblCompany.Text = "Company"
'
'txtCompany
'
Me.txtCompany.Location = New System.Drawing.Point(216, 88)
Me.txtCompany.Name = "txtCompany"
Me.txtCompany.Size = New System.Drawing.Size(200, 20)
Me.txtCompany.TabIndex = 2
Me.txtCompany.Text = ""
'
'frmCustomers
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(427, 248)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtEmail, Me.txtID, Me.lblEmail, Me.lblID, Me.txtAddress, Me.lblAddress, Me.lstCustomers, Me.lblCompany, Me.txtCompany})
Me.Name = "frmCustomers"
Me.Text = "Customer Details"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub frmCustomer_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
objCargo.GetCustomers()
Dim CurRows() As DataRow, CurRow As DataRow
CurRows = objCargo.CustList.Select()
For Each CurRow In CurRows
lstCustomers.Items.Add(CurRow("FirstName").ToString & _
" " & CurRow("LastName").ToString)
Next
lstCustomers.SetSelected(0, True)
End Sub
Private Sub lstCustomers_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstCustomers.SelectedIndexChanged
Dim RowNum As Integer = lstCustomers.SelectedIndex
Dim CurRow As DataRow = objCargo.CustList.Rows(RowNum)
txtID.Text = CurRow("CustomerID")
txtCompany.Text = CurRow("CompanyName")
txtEmail.Text = CurRow("Email")
txtAddress.Text = CurRow("Address")
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -