Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
Dim SelectedItems As ListView.SelectedListViewItemCollection = _
CType(sender, ListView).SelectedItems
If (SelectedItems.Count > 0) Then
TextBox1.Text = SelectedItems(0).SubItems(0).Text
TextBox2.Text = SelectedItems(0).SubItems(1).Text
DateTimePicker1.Text = SelectedItems(0).SubItems(2).Text
ComboBox1.Text = SelectedItems(0).SubItems(4).Text
TextBox4.Text = SelectedItems(0).SubItems(3).Text
ComboBox2.Text = SelectedItems(0).SubItems(5).Text
TextBox6.Text = SelectedItems(0).SubItems(7).Text
End If
End Sub
Tag : .NET, Ms SQL Server 2008, VBScript, VB.NET, VS 2010 (.NET 4.x), Windows
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim mm As New order()
If (TextBox2.Text <> "") Then
Try
mm.or_code = TextBox2.Text
mm.or_date = System.DateTime.Now
mm.cus_name_o = ComboBox1.Text
mm.or_price = TextBox4.Text
mm.type_name_o = CheckBox1.Text
mm.bank_name_o = ComboBox2.Text
mm.or_remark = TextBox6.Text
db.orders.InsertOnSubmit(mm)
db.SubmitChanges()
MsgBox("ทำรายการ สำเร็จ.", MsgBoxStyle.Information)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
fill_listview()