How do you show on textboxes in Form2 the items on listbox in form1. Like i have a "123" data on listbox1 (Form1) then i need to check that if it matches in my database, and if it does, on form2 textboxes, it will display additional information of that from database.
VB.NET:
Form1
Private Sub listBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles listBox3.SelectedIndexChanged
Form2.TextBox6.Text = listBox3.GetItemText(listBox3.SelectedItem)
If listBox3.GetItemText(listBox3.SelectedItem) = "09 00 EE 00 1F 4F 30 00 75 E0 " Then
MsgBox("SUCCESS")
'Me.Hide()
Form2.Show()
Else
MsgBox("FAIL")
End If
End Sub
VB.NET:
Form2
connstring = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Csrp2_DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
conn.ConnectionString = connstring
If TextBox6.Text = "09 00 EE 00 1F 4F 30 00 75 E0 " Then
sql = "SELECT * from Csrp2_table1 Where Title='" & UCase(TextBox1.Text) & "'" + _
",Author='" & UCase(TextBox2.Text) & "'" + _
",Price='" & UCase(TextBox3.Text) & "'" + _
",Stock='" & UCase(TextBox4.Text) & "')"
Else
MsgBox("FAIL")
End If