?? addstuinfo.vb
字號:
Public Class AddStuInfo
Inherits System.Windows.Forms.Form
#Region " Windows 窗體設(shè)計器生成的代碼 "
Public Sub New()
MyBase.New()
'該調(diào)用是 Windows 窗體設(shè)計器所必需的。
InitializeComponent()
'在 InitializeComponent() 調(diào)用之后添加任何初始化
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 窗體設(shè)計器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下過程是 Windows 窗體設(shè)計器所必需的
'可以使用 Windows 窗體設(shè)計器修改此過程。
'不要使用代碼編輯器修改它。
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
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 Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox
Friend WithEvents NumericTextBox1 As NumericTextbox.NumericTextBox
Friend WithEvents NumericTextBox2 As NumericTextbox.NumericTextBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.ComboBox1 = New System.Windows.Forms.ComboBox
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Label6 = New System.Windows.Forms.Label
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.ComboBox2 = New System.Windows.Forms.ComboBox
Me.NumericTextBox1 = New NumericTextbox.NumericTextBox
Me.NumericTextBox2 = New NumericTextbox.NumericTextBox
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("宋體", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.Location = New System.Drawing.Point(32, 48)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 24)
Me.Label1.TabIndex = 0
Me.Label1.Text = "學(xué)號:"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(104, 168)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(336, 21)
Me.TextBox2.TabIndex = 3
Me.TextBox2.Text = ""
'
'Label2
'
Me.Label2.Font = New System.Drawing.Font("宋體", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label2.Location = New System.Drawing.Point(248, 48)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 24)
Me.Label2.TabIndex = 2
Me.Label2.Text = "姓名:"
'
'Label3
'
Me.Label3.Font = New System.Drawing.Font("宋體", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label3.Location = New System.Drawing.Point(32, 88)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(56, 24)
Me.Label3.TabIndex = 4
Me.Label3.Text = "性別:"
'
'ComboBox1
'
Me.ComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox1.Items.AddRange(New Object() {"男", "女"})
Me.ComboBox1.Location = New System.Drawing.Point(104, 88)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(121, 20)
Me.ComboBox1.TabIndex = 5
'
'Label4
'
Me.Label4.Font = New System.Drawing.Font("宋體", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label4.Location = New System.Drawing.Point(32, 128)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(56, 24)
Me.Label4.TabIndex = 6
Me.Label4.Text = "班級:"
'
'Label5
'
Me.Label5.Font = New System.Drawing.Font("宋體", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label5.Location = New System.Drawing.Point(248, 88)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(56, 24)
Me.Label5.TabIndex = 8
Me.Label5.Text = "年齡:"
'
'Label6
'
Me.Label6.Font = New System.Drawing.Font("宋體", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label6.Location = New System.Drawing.Point(8, 168)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(80, 24)
Me.Label6.TabIndex = 10
Me.Label6.Text = "家庭住址:"
'
'Button1
'
Me.Button1.Font = New System.Drawing.Font("宋體", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Button1.Location = New System.Drawing.Point(64, 232)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(112, 32)
Me.Button1.TabIndex = 12
Me.Button1.Text = "確定添加"
'
'Button2
'
Me.Button2.Font = New System.Drawing.Font("宋體", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Button2.Location = New System.Drawing.Point(240, 232)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(112, 32)
Me.Button2.TabIndex = 13
Me.Button2.Text = "退出添加"
'
'ComboBox2
'
Me.ComboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox2.Items.AddRange(New Object() {"可視化程序設(shè)計", "WEB程序設(shè)計", "網(wǎng)絡(luò)系統(tǒng)管理員", "數(shù)據(jù)庫系統(tǒng)管理員", "網(wǎng)絡(luò)構(gòu)建", "圖形圖象", "計算機(jī)應(yīng)用"})
Me.ComboBox2.Location = New System.Drawing.Point(104, 128)
Me.ComboBox2.Name = "ComboBox2"
Me.ComboBox2.Size = New System.Drawing.Size(121, 20)
Me.ComboBox2.TabIndex = 14
'
'NumericTextBox1
'
Me.NumericTextBox1.Location = New System.Drawing.Point(104, 48)
Me.NumericTextBox1.Name = "NumericTextBox1"
Me.NumericTextBox1.Size = New System.Drawing.Size(120, 21)
Me.NumericTextBox1.TabIndex = 17
Me.NumericTextBox1.Text = ""
'
'NumericTextBox2
'
Me.NumericTextBox2.Location = New System.Drawing.Point(320, 88)
Me.NumericTextBox2.Name = "NumericTextBox2"
Me.NumericTextBox2.Size = New System.Drawing.Size(120, 21)
Me.NumericTextBox2.TabIndex = 18
Me.NumericTextBox2.Text = ""
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(320, 48)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(120, 21)
Me.TextBox1.TabIndex = 19
Me.TextBox1.Text = ""
'
'AddStuInfo
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(456, 333)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.NumericTextBox2)
Me.Controls.Add(Me.NumericTextBox1)
Me.Controls.Add(Me.ComboBox2)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.ComboBox1)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Name = "AddStuInfo"
Me.Text = "添加學(xué)生信息"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Dispose()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If NumericTextBox1.Text = "" Then
MsgBox("請輸入學(xué)生學(xué)號!", MsgBoxStyle.OKOnly, "警告")
NumericTextBox1.Focus()
Exit Sub
End If
If TextBox1.Text = "" Then
MsgBox("請輸入學(xué)生姓名!", MsgBoxStyle.OKOnly, "警告")
TextBox1.Focus()
Exit Sub
End If
If NumericTextBox2.Text = "" Then
MsgBox("請輸入學(xué)生年齡!", MsgBoxStyle.OKOnly, "警告")
NumericTextBox2.Focus()
Exit Sub
End If
If TextBox2.Text = "" Then
MsgBox("請輸入學(xué)生家庭住址!", MsgBoxStyle.OKOnly, "警告")
TextBox2.Focus()
Exit Sub
End If
Dim ds As New DataSet
ds = search.query("select * from T_Stu where C_StuId = '" & NumericTextBox1.Text & "' ")
If ds.Tables(0).Rows.Count <> 0 Then
MsgBox("學(xué)號重復(fù),請核實后再添加!", MsgBoxStyle.OKOnly, "警告")
NumericTextBox1.Focus()
Exit Sub
End If
search.insert("insert into T_Stu values('" & NumericTextBox1.Text & "','" & TextBox1.Text & "','" & ComboBox1.Text & "','" & ComboBox2.Text & "','" & NumericTextBox2.Text & "','" & TextBox2.Text & "')")
MsgBox("添加成功!", MsgBoxStyle.OKOnly, "提示")
NumericTextBox1.Text = ""
NumericTextBox2.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -