| | |
How I can display selected value from combo box in data grid view using VB.Net?
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
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 |
.net .net2008 2005 2008 access account arithmetic array basic beginner bing browser button buttons center check code combobox crystalreport cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic dropdownlist excel fade file-dialog filter forms ftp generatetags hardcopy html images input insert intel internet mobile monitor ms net networking objects open output panel passingparameters pdf picturebox picturebox1 port position printing problem project save searchvb.net select serial settings shutdown soap sqlserver survey tcp temperature text textbox timer timespan toolbox transparency trim update updown user vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet view visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode year





