0

Private Sub frmtourmaster1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ds As DataSet
Dim i As Integer
objConn = New connctionclass1
ds = New DataSet

ds = objConn.funFillTourLocation()
For i = 0 To ds.Tables(0).Rows.Count - 1
cmbindiantourcode.Items.Add(ds.Tables(0).Rows(i).Item("tour_location"))
Next
cmbindiantourcode.SelectedIndex = 0
End sub

My connection to the database is done.
I hve created a connection class & imported here & in that connection class I hve created a function named funFillTourLocation() & called here. Through this code i hve extraced a column named Tour_location from the database in the combo box.
Now i want that when I select a particular value in the combox box, the details related to the selected value in the combo box should get displayed in the data grid view from the database.

3
Contributors
2
Replies
7
Views
8 Years
Discussion Span
Last Post by gomathinayagam
0

You could run separate SQL Select statements for the selected item

SELECT * FROM table WHERE Tour_location = '" & cmbindiantourcode.text & "'"

or you could download the whole table and bind to the datagrid then run a command like

ds.tables(0).Select("Tour_location = '" & cmbindiantourcode.text & "'")
0

Please help me. I want display the selected data from combobox in datagridview in vb.net. i've 5 combobox used in my project, but i want select the combobox value random and bind the data in datagridview control.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.