DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   How I can display selected value from combo box in data grid view using VB.Net? (http://www.daniweb.com/forums/thread112953.html)

vibhashin Mar 9th, 2008 9:43 am
How I can display selected value from combo box in data grid view using VB.Net?
 
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.

ptaylor965 Mar 9th, 2008 11:03 am
Re: How I can display selected value from combo box in data grid view using VB.Net?
 
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 & "'")

gomathinayagam Dec 1st, 2008 9:41 am
Re: How I can display selected value from combo box in data grid view using VB.Net?
 
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.


All times are GMT -4. The time now is 11:36 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC