📄 formcompany.vb
字号:
Imports System
Imports System.Reflection
Public Class FormCompany
Inherits System.Windows.Forms.Form
#Region "User Defined Members"
Private oCompany As Company
#End Region
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
oCompany = New Company
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 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 Panel1 As System.Windows.Forms.Panel
Friend WithEvents Panel2 As System.Windows.Forms.Panel
Friend WithEvents btnUpdate As System.Windows.Forms.Button
Friend WithEvents btnReset As System.Windows.Forms.Button
Friend WithEvents txtName As System.Windows.Forms.TextBox
Friend WithEvents txtCorporation As System.Windows.Forms.TextBox
Friend WithEvents txtLinkman As System.Windows.Forms.TextBox
Friend WithEvents txtPhone As System.Windows.Forms.TextBox
Friend WithEvents txtFax As System.Windows.Forms.TextBox
Friend WithEvents txtEmail As System.Windows.Forms.TextBox
Friend WithEvents txtAddress As System.Windows.Forms.TextBox
Friend WithEvents txtPostalcode As System.Windows.Forms.TextBox
Friend WithEvents btnExit As System.Windows.Forms.Button
Friend WithEvents btnRefresh As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
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.txtName = New System.Windows.Forms.TextBox
Me.txtCorporation = New System.Windows.Forms.TextBox
Me.txtLinkman = New System.Windows.Forms.TextBox
Me.txtPhone = New System.Windows.Forms.TextBox
Me.txtFax = New System.Windows.Forms.TextBox
Me.txtEmail = New System.Windows.Forms.TextBox
Me.txtAddress = New System.Windows.Forms.TextBox
Me.txtPostalcode = New System.Windows.Forms.TextBox
Me.Panel1 = New System.Windows.Forms.Panel
Me.Panel2 = New System.Windows.Forms.Panel
Me.btnReset = New System.Windows.Forms.Button
Me.btnUpdate = New System.Windows.Forms.Button
Me.btnRefresh = New System.Windows.Forms.Button
Me.btnExit = New System.Windows.Forms.Button
Me.Panel2.SuspendLayout()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(104, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(100, 20)
Me.Label1.TabIndex = 0
Me.Label1.Text = "公司名称"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(104, 64)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(100, 20)
Me.Label2.TabIndex = 1
Me.Label2.Text = "法人代表"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(104, 104)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(100, 20)
Me.Label3.TabIndex = 2
Me.Label3.Text = "联系人"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(104, 144)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(100, 20)
Me.Label4.TabIndex = 3
Me.Label4.Text = "电话"
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(104, 184)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(100, 20)
Me.Label5.TabIndex = 4
Me.Label5.Text = "传真"
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(104, 216)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(100, 20)
Me.Label6.TabIndex = 5
Me.Label6.Text = "Email"
'
'Label7
'
Me.Label7.Location = New System.Drawing.Point(104, 264)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(100, 20)
Me.Label7.TabIndex = 6
Me.Label7.Text = "地址"
'
'Label8
'
Me.Label8.Location = New System.Drawing.Point(104, 304)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(100, 20)
Me.Label8.TabIndex = 7
Me.Label8.Text = "邮政编码"
'
'txtName
'
Me.txtName.Location = New System.Drawing.Point(224, 16)
Me.txtName.Name = "txtName"
Me.txtName.Size = New System.Drawing.Size(300, 21)
Me.txtName.TabIndex = 8
Me.txtName.Text = "TextBox1"
'
'txtCorporation
'
Me.txtCorporation.Location = New System.Drawing.Point(224, 64)
Me.txtCorporation.Name = "txtCorporation"
Me.txtCorporation.Size = New System.Drawing.Size(300, 21)
Me.txtCorporation.TabIndex = 9
Me.txtCorporation.Text = "TextBox2"
'
'txtLinkman
'
Me.txtLinkman.Location = New System.Drawing.Point(224, 104)
Me.txtLinkman.Name = "txtLinkman"
Me.txtLinkman.Size = New System.Drawing.Size(300, 21)
Me.txtLinkman.TabIndex = 10
Me.txtLinkman.Text = "TextBox3"
'
'txtPhone
'
Me.txtPhone.Location = New System.Drawing.Point(224, 144)
Me.txtPhone.Name = "txtPhone"
Me.txtPhone.Size = New System.Drawing.Size(300, 21)
Me.txtPhone.TabIndex = 11
Me.txtPhone.Text = "TextBox4"
'
'txtFax
'
Me.txtFax.Location = New System.Drawing.Point(224, 184)
Me.txtFax.Name = "txtFax"
Me.txtFax.Size = New System.Drawing.Size(300, 21)
Me.txtFax.TabIndex = 12
Me.txtFax.Text = "TextBox5"
'
'txtEmail
'
Me.txtEmail.Location = New System.Drawing.Point(224, 216)
Me.txtEmail.Name = "txtEmail"
Me.txtEmail.Size = New System.Drawing.Size(300, 21)
Me.txtEmail.TabIndex = 13
Me.txtEmail.Text = "TextBox6"
'
'txtAddress
'
Me.txtAddress.Location = New System.Drawing.Point(224, 264)
Me.txtAddress.Name = "txtAddress"
Me.txtAddress.Size = New System.Drawing.Size(300, 21)
Me.txtAddress.TabIndex = 14
Me.txtAddress.Text = "TextBox7"
'
'txtPostalcode
'
Me.txtPostalcode.Location = New System.Drawing.Point(224, 304)
Me.txtPostalcode.Name = "txtPostalcode"
Me.txtPostalcode.Size = New System.Drawing.Size(300, 21)
Me.txtPostalcode.TabIndex = 15
Me.txtPostalcode.Text = "TextBox8"
'
'Panel1
'
Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Panel1.Location = New System.Drawing.Point(88, 8)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(448, 328)
Me.Panel1.TabIndex = 16
'
'Panel2
'
Me.Panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Panel2.Controls.Add(Me.btnExit)
Me.Panel2.Controls.Add(Me.btnRefresh)
Me.Panel2.Controls.Add(Me.btnReset)
Me.Panel2.Controls.Add(Me.btnUpdate)
Me.Panel2.Location = New System.Drawing.Point(88, 344)
Me.Panel2.Name = "Panel2"
Me.Panel2.Size = New System.Drawing.Size(448, 48)
Me.Panel2.TabIndex = 17
'
'btnReset
'
Me.btnReset.Location = New System.Drawing.Point(232, 8)
Me.btnReset.Name = "btnReset"
Me.btnReset.TabIndex = 1
Me.btnReset.Text = "重 置"
'
'btnUpdate
'
Me.btnUpdate.Location = New System.Drawing.Point(48, 8)
Me.btnUpdate.Name = "btnUpdate"
Me.btnUpdate.TabIndex = 0
Me.btnUpdate.Text = "更 新"
'
'btnRefresh
'
Me.btnRefresh.Location = New System.Drawing.Point(144, 8)
Me.btnRefresh.Name = "btnRefresh"
Me.btnRefresh.TabIndex = 2
Me.btnRefresh.Text = "刷 新"
'
'btnExit
'
Me.btnExit.Location = New System.Drawing.Point(328, 8)
Me.btnExit.Name = "btnExit"
Me.btnExit.TabIndex = 3
Me.btnExit.Text = "退 出"
'
'FormCompany
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(610, 408)
Me.Controls.Add(Me.Panel2)
Me.Controls.Add(Me.txtPostalcode)
Me.Controls.Add(Me.txtAddress)
Me.Controls.Add(Me.txtEmail)
Me.Controls.Add(Me.txtFax)
Me.Controls.Add(Me.txtPhone)
Me.Controls.Add(Me.txtLinkman)
Me.Controls.Add(Me.txtCorporation)
Me.Controls.Add(Me.txtName)
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.Panel1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Name = "FormCompany"
Me.Text = "公司设置"
Me.Panel2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub SetTextbox()
txtName.Text = oCompany.Name
txtCorporation.Text = oCompany.Corporation
txtLinkman.Text = oCompany.Linkman
txtPhone.Text = oCompany.Phone
txtFax.Text = oCompany.Fax
txtEmail.Text = oCompany.Email
txtAddress.Text = oCompany.Address
txtPostalcode.Text = oCompany.PostalCode
End Sub
Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
Dim tpTextBox As Type
tpTextBox = New TextBox().GetType()
For Each ctlTemp As Control In Me.Controls
If ctlTemp.GetType() Is tpTextBox Then
ctlTemp.Text = ""
End If
Next
End Sub
Private Sub FormCompany_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetTextbox()
End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
oCompany.Name = txtName.Text
oCompany.Corporation = txtCorporation.Text
oCompany.Linkman = txtLinkman.Text
oCompany.Phone = txtPhone.Text
oCompany.Fax = txtFax.Text
oCompany.Email = txtEmail.Text
oCompany.Address = txtAddress.Text
oCompany.PostalCode = txtPostalcode.Text
oCompany.Update()
End Sub
Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
SetTextbox()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -