| | |
How I can display selected value from combo box in data grid view using VB.Net?
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Mar 2008
Posts: 7
Reputation:
Solved Threads: 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.
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.
Re: How I can display selected value from combo box in data grid view using VB.Net?
0
#2 Mar 9th, 2008
You could run separate SQL Select statements for the selected item
or you could download the whole table and bind to the datagrid then run a command like
VB.NET Syntax (Toggle Plain Text)
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
VB.NET Syntax (Toggle Plain Text)
ds.tables(0).Select("Tour_location = '" & cmbindiantourcode.text & "'")
•
•
Join Date: Nov 2008
Posts: 15
Reputation:
Solved Threads: 1
Re: How I can display selected value from combo box in data grid view using VB.Net?
0
#3 Dec 1st, 2008
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: Displaying a list of Databases in a combo box
- Next Thread: adding item from text box to list box
| Thread Tools | Search this Thread |
"crystal .net .net2005 .net2008 2008 access add application array assignment basic beginner box browser button buttons click code combo convert cpu cuesent database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationthesis dissertationtopic dosconsolevb.net editvb.net exists fade filter firewall forms html image images input isnumericfuntioncall listview math mobile module mssqlbackend mysql navigate number opacity open panel picturebox picturebox2 port print printing printpreview record regex reports" reuse right-to-left savedialog serial settings shutdown socket sqldatbase sqlserver storedprocedure string survey temp temperature textbox timer timespan transparency txttoxmlconverter useraccounts usercontol usercontrol vb vb.net vb.nettoolboxvisualbasic2008sidebar vbnet vista visual visualbasic.net visualstudio.net web winforms wpf wrapingcode xml year





