📄 ac.vb
字号:
'
'TextBox7
'
Me.TextBox7.Location = New System.Drawing.Point(272, 56)
Me.TextBox7.Name = "TextBox7"
Me.TextBox7.Size = New System.Drawing.Size(104, 21)
Me.TextBox7.TabIndex = 15
Me.TextBox7.Text = ""
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(208, 64)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(56, 16)
Me.Label6.TabIndex = 5
Me.Label6.Text = "内部价格"
Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'TextBox6
'
Me.TextBox6.Location = New System.Drawing.Point(272, 24)
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(104, 21)
Me.TextBox6.TabIndex = 14
Me.TextBox6.Text = ""
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(88, 112)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(104, 21)
Me.TextBox4.TabIndex = 13
Me.TextBox4.Text = ""
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(27, 144)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(56, 16)
Me.Label5.TabIndex = 4
Me.Label5.Text = "产品质保"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(88, 82)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(104, 21)
Me.TextBox3.TabIndex = 12
Me.TextBox3.Text = ""
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(28, 119)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(56, 16)
Me.Label4.TabIndex = 3
Me.Label4.Text = "产品厂家"
Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(28, 88)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(56, 16)
Me.Label3.TabIndex = 2
Me.Label3.Text = "产品类型"
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label9
'
Me.Label9.Location = New System.Drawing.Point(208, 32)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(56, 16)
Me.Label9.TabIndex = 3
Me.Label9.Text = "外部价格"
Me.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'TextBox9
'
Me.TextBox9.Location = New System.Drawing.Point(272, 117)
Me.TextBox9.Name = "TextBox9"
Me.TextBox9.Size = New System.Drawing.Size(104, 21)
Me.TextBox9.TabIndex = 20
Me.TextBox9.Text = ""
'
'Label10
'
Me.Label10.ImageAlign = System.Drawing.ContentAlignment.TopCenter
Me.Label10.Location = New System.Drawing.Point(208, 152)
Me.Label10.Name = "Label10"
Me.Label10.Size = New System.Drawing.Size(56, 16)
Me.Label10.TabIndex = 7
Me.Label10.Text = "产品图片"
Me.Label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(32, 27)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 16)
Me.Label2.TabIndex = 24
Me.Label2.Text = "产品型号"
'
'TextBox10
'
Me.TextBox10.Location = New System.Drawing.Point(272, 146)
Me.TextBox10.Name = "TextBox10"
Me.TextBox10.Size = New System.Drawing.Size(104, 21)
Me.TextBox10.TabIndex = 25
Me.TextBox10.Text = ""
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.ComboBox1)
Me.GroupBox1.Controls.Add(Me.Label11)
Me.GroupBox1.Controls.Add(Me.TextBox1)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.TextBox2)
Me.GroupBox1.Controls.Add(Me.TextBox5)
Me.GroupBox1.Controls.Add(Me.TextBox8)
Me.GroupBox1.Controls.Add(Me.Label8)
Me.GroupBox1.Controls.Add(Me.Label7)
Me.GroupBox1.Controls.Add(Me.TextBox7)
Me.GroupBox1.Controls.Add(Me.Label6)
Me.GroupBox1.Controls.Add(Me.TextBox6)
Me.GroupBox1.Controls.Add(Me.TextBox4)
Me.GroupBox1.Controls.Add(Me.Label5)
Me.GroupBox1.Controls.Add(Me.TextBox3)
Me.GroupBox1.Controls.Add(Me.Label4)
Me.GroupBox1.Controls.Add(Me.Label3)
Me.GroupBox1.Controls.Add(Me.Button1)
Me.GroupBox1.Controls.Add(Me.Button2)
Me.GroupBox1.Controls.Add(Me.Label9)
Me.GroupBox1.Controls.Add(Me.TextBox9)
Me.GroupBox1.Controls.Add(Me.Label10)
Me.GroupBox1.Controls.Add(Me.Label2)
Me.GroupBox1.Controls.Add(Me.TextBox10)
Me.GroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.GroupBox1.Location = New System.Drawing.Point(4, 13)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(590, 179)
Me.GroupBox1.TabIndex = 21
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "商品增加"
'
'GroupBox3
'
Me.GroupBox3.Location = New System.Drawing.Point(616, 13)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.Size = New System.Drawing.Size(200, 179)
Me.GroupBox3.TabIndex = 26
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "产品图片"
'
'ac
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(824, 408)
Me.Controls.Add(Me.GroupBox3)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Name = "ac"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "商品增加窗口"
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
Me.GroupBox2.ResumeLayout(False)
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If MyConnection.State = ConnectionState.Closed Then
MyConnection.Open()
End If
Mydapater.Fill(MyDataset, "MyProductsTable") '填充数据集
Me.WindowState = FormWindowState.Normal '设置窗体的形式为正常原始大小
Me.StartPosition = FormStartPosition.CenterParent '设置窗口的位置
DataGrid1.DataSource = MyDataset.Tables("MyProductsTable") '把数据交给数据网格对象
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If MyConnection.State = ConnectionState.Closed Then
MyConnection.Open()
End If
Dim Cmm As New OleDbCommandBuilder(Mydapater) '新增一个CommandBuilder的对象来邦定数据增加操作
MyRow = MyDataset.Tables("MyProductsTable").NewRow '在数据集中增加一个新的空行
MyRow(0) = TextBox1.Text
MyRow(1) = TextBox2.Text
MyRow(2) = TextBox3.Text
MyRow(3) = TextBox4.Text
MyRow(4) = Val(TextBox5.Text)
MyRow(5) = Val(TextBox6.Text)
MyRow(6) = Val(TextBox7.Text)
MyRow(7) = Val(TextBox8.Text)
MyRow(8) = TextBox9.Text
MyRow(9) = ComboBox1.Text
MyDataset.Tables("MyProductsTable").Rows.Add(MyRow) '提交数据到数据集中
Mydapater.Update(MyDataset, "MyProductsTable") '通过更改的数据集更新数据库
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Msg As String
Msg = "你确信要关闭 " & Me.Text
If MsgBox(Msg, 36, Me.Text) = 7 Then
MyBase.Close()
End If
End Sub
Private Sub ac_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Dim Msg As String
Msg = "你确信要关闭 " & Me.Text
If MsgBox(Msg, 36, Me.Text) = 7 Then
e.Cancel = True
MyBase.Close()
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -