📄 frmcustomer.vb
字号:
Imports System.Data
Imports System.Data.SqlClient
Public Class frmCustomer
Inherits System.Windows.Forms.Form
Private myDataAdapter As New SqlClient.SqlDataAdapter
Private myDataReader As SqlClient.SqlDataAdapter
Private myDataSet As DataSet = New DataSet("customer")
Private neworchange As Boolean
Private TableName As String
Private myIndex As Integer = 0
Private RowsMax As Integer
Private Sub Cshowfield()
If myIndex >= 0 Then
Dim currRows() As DataRow = myDataSet.Tables(0).Select(Nothing, Nothing, DataViewRowState.CurrentRows)
Dim myRow As DataRow = currRows(myIndex)
TxtId.Text = myRow("c_id")
txtName.Text = myRow("c_name")
txtAddr.Text = myRow("c_addr")
txtPhone.Text = myRow("c_phone")
End If
End Sub
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
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
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents bunUpdate As System.Windows.Forms.Button
Friend WithEvents bunNext As System.Windows.Forms.Button
Friend WithEvents bunCancel As System.Windows.Forms.Button
Friend WithEvents bunSave As System.Windows.Forms.Button
Friend WithEvents bunSearch As System.Windows.Forms.Button
Friend WithEvents bunDelete As System.Windows.Forms.Button
Friend WithEvents bunAdd As System.Windows.Forms.Button
Friend WithEvents bunPrevious As System.Windows.Forms.Button
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtPhone As System.Windows.Forms.TextBox
Friend WithEvents txtAddr As System.Windows.Forms.TextBox
Friend WithEvents txtName As System.Windows.Forms.TextBox
Friend WithEvents TxtId As System.Windows.Forms.TextBox
Friend WithEvents Label8 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.bunUpdate = New System.Windows.Forms.Button
Me.bunNext = New System.Windows.Forms.Button
Me.bunCancel = New System.Windows.Forms.Button
Me.bunSave = New System.Windows.Forms.Button
Me.bunSearch = New System.Windows.Forms.Button
Me.bunDelete = New System.Windows.Forms.Button
Me.bunAdd = New System.Windows.Forms.Button
Me.bunPrevious = New System.Windows.Forms.Button
Me.Label4 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.txtPhone = New System.Windows.Forms.TextBox
Me.txtAddr = New System.Windows.Forms.TextBox
Me.txtName = New System.Windows.Forms.TextBox
Me.TxtId = New System.Windows.Forms.TextBox
Me.Label8 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'bunUpdate
'
Me.bunUpdate.Location = New System.Drawing.Point(344, 144)
Me.bunUpdate.Name = "bunUpdate"
Me.bunUpdate.Size = New System.Drawing.Size(88, 24)
Me.bunUpdate.TabIndex = 30
Me.bunUpdate.Text = "更新到数据库"
'
'bunNext
'
Me.bunNext.Location = New System.Drawing.Point(296, 144)
Me.bunNext.Name = "bunNext"
Me.bunNext.Size = New System.Drawing.Size(32, 24)
Me.bunNext.TabIndex = 29
Me.bunNext.Text = ">>"
'
'bunCancel
'
Me.bunCancel.Location = New System.Drawing.Point(248, 144)
Me.bunCancel.Name = "bunCancel"
Me.bunCancel.Size = New System.Drawing.Size(40, 24)
Me.bunCancel.TabIndex = 28
Me.bunCancel.Text = "取消"
'
'bunSave
'
Me.bunSave.Location = New System.Drawing.Point(200, 144)
Me.bunSave.Name = "bunSave"
Me.bunSave.Size = New System.Drawing.Size(40, 24)
Me.bunSave.TabIndex = 27
Me.bunSave.Text = "保存"
'
'bunSearch
'
Me.bunSearch.Location = New System.Drawing.Point(152, 144)
Me.bunSearch.Name = "bunSearch"
Me.bunSearch.Size = New System.Drawing.Size(40, 24)
Me.bunSearch.TabIndex = 26
Me.bunSearch.Text = "搜索"
'
'bunDelete
'
Me.bunDelete.Location = New System.Drawing.Point(104, 144)
Me.bunDelete.Name = "bunDelete"
Me.bunDelete.Size = New System.Drawing.Size(40, 24)
Me.bunDelete.TabIndex = 25
Me.bunDelete.Text = "删除"
'
'bunAdd
'
Me.bunAdd.Location = New System.Drawing.Point(56, 144)
Me.bunAdd.Name = "bunAdd"
Me.bunAdd.Size = New System.Drawing.Size(40, 24)
Me.bunAdd.TabIndex = 24
Me.bunAdd.Text = "添加"
'
'bunPrevious
'
Me.bunPrevious.Location = New System.Drawing.Point(16, 144)
Me.bunPrevious.Name = "bunPrevious"
Me.bunPrevious.Size = New System.Drawing.Size(32, 24)
Me.bunPrevious.TabIndex = 23
Me.bunPrevious.Text = "<<"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(8, 80)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(56, 24)
Me.Label4.TabIndex = 34
Me.Label4.Text = " 电话:"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(8, 48)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(56, 24)
Me.Label3.TabIndex = 33
Me.Label3.Text = " 地址:"
'
'Label2
'
Me.Label2.ForeColor = System.Drawing.Color.Red
Me.Label2.Location = New System.Drawing.Point(224, 16)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 24)
Me.Label2.TabIndex = 32
Me.Label2.Text = "※姓名:"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 24)
Me.Label1.TabIndex = 31
Me.Label1.Text = " 编号:"
'
'txtPhone
'
Me.txtPhone.Location = New System.Drawing.Point(72, 80)
Me.txtPhone.Name = "txtPhone"
Me.txtPhone.Size = New System.Drawing.Size(352, 21)
Me.txtPhone.TabIndex = 38
Me.txtPhone.Text = ""
'
'txtAddr
'
Me.txtAddr.Location = New System.Drawing.Point(72, 48)
Me.txtAddr.Name = "txtAddr"
Me.txtAddr.Size = New System.Drawing.Size(352, 21)
Me.txtAddr.TabIndex = 37
Me.txtAddr.Text = ""
'
'txtName
'
Me.txtName.BackColor = System.Drawing.SystemColors.Window
Me.txtName.Location = New System.Drawing.Point(280, 16)
Me.txtName.Name = "txtName"
Me.txtName.Size = New System.Drawing.Size(144, 21)
Me.txtName.TabIndex = 36
Me.txtName.Text = ""
'
'TxtId
'
Me.TxtId.BackColor = System.Drawing.SystemColors.Window
Me.TxtId.Enabled = False
Me.TxtId.ForeColor = System.Drawing.SystemColors.WindowText
Me.TxtId.Location = New System.Drawing.Point(72, 16)
Me.TxtId.Name = "TxtId"
Me.TxtId.Size = New System.Drawing.Size(144, 21)
Me.TxtId.TabIndex = 35
Me.TxtId.Text = ""
'
'Label8
'
Me.Label8.ForeColor = System.Drawing.Color.Red
Me.Label8.Location = New System.Drawing.Point(24, 112)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(400, 24)
Me.Label8.TabIndex = 39
Me.Label8.Text = "前面带※的必须填写!"
'
'frmCustomer
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(440, 182)
Me.Controls.Add(Me.Label8)
Me.Controls.Add(Me.txtPhone)
Me.Controls.Add(Me.txtAddr)
Me.Controls.Add(Me.txtName)
Me.Controls.Add(Me.TxtId)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.bunUpdate)
Me.Controls.Add(Me.bunNext)
Me.Controls.Add(Me.bunCancel)
Me.Controls.Add(Me.bunSave)
Me.Controls.Add(Me.bunSearch)
Me.Controls.Add(Me.bunDelete)
Me.Controls.Add(Me.bunAdd)
Me.Controls.Add(Me.bunPrevious)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmCustomer"
Me.Text = "客户数据表"
Me.ResumeLayout(False)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -