16-05-20, 02:44 PM
(16-05-20, 12:38 PM)WaeLx كتب :(16-05-20, 08:57 AM)paveldida كتب :بسم الله الرحمان الرحيمالسلام عليكمأريد ربط Combobox مع TextBox_TextChanged لكي يكون لكل خيار من الكمبوبوكس كود محدد في textbox_textchanged1
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
repto.Clear()nota = New OleDbDataAdapter("select * from Table1 where Name1 like'%" & TextBox1.Text & "%'", con)nota.Fill(repto)End Sub
2Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
repto.Clear()
nota = New OleDbDataAdapter("select * from Table1 where Name2 like'%" & TextBox1.Text & "%'", con)
nota.Fill(repto)
End Sub
وعليكم السلام و رحمة الله و بركاته
تستطيع استخدام قاعدة if
و تقوم بربطها اما ب combobox selected index او combobox text
كود :
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
If combobox1.text = "option1" then
repto.Clear()
nota = New OleDbDataAdapter("select * from Table1 where Name1 like'%" & TextBox1.Text & "%'", con)
nota.Fill(repto)
else If combobox1.text = "option2" then
repto.Clear()
nota = New OleDbDataAdapter("select * from Table1 where Name2 like'%" & TextBox1.Text & "%'", con)
nota.Fill(repto)
end if
End Sub
بارك الله فيك أخي
