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
Reply

Join Date: Mar 2008
Posts: 7
Reputation: vibhashin is an unknown quantity at this point 
Solved Threads: 0
vibhashin vibhashin is offline Offline
Newbie Poster

How I can display selected value from combo box in data grid view using VB.Net?

 
0
  #1
Mar 9th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 169
Reputation: ptaylor965 is an unknown quantity at this point 
Solved Threads: 19
Sponsor
ptaylor965's Avatar
ptaylor965 ptaylor965 is offline Offline
Junior Poster

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
  1. 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
  1. ds.tables(0).Select("Tour_location = '" & cmbindiantourcode.text & "'")
Peter Taylor
Visual Basic.NET Application Developer

TaylorsNet
http://www.taylorsnet.co.uk
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 15
Reputation: gomathinayagam is an unknown quantity at this point 
Solved Threads: 1
gomathinayagam gomathinayagam is offline Offline
Newbie Poster

Re: How I can display selected value from combo box in data grid view using VB.Net?

 
0
  #3
Dec 1st, 2008
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.
Regard,
A.Gomathinayagam
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC