• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

Display a record on my form based on value I select in my ComboBox

I have a standard windows form that uses a dataset to get all of the textboxes populated from a single table.  I would like to display the data related to the key field called ctl_num that is selected from the combo.
0
H-SC
Asked:
H-SC
  • 2
  • 2
1 Solution
 
jindalankushCommented:
1.get all data in single record set
2. filter data according to key
3. then  fill data on corresponding field
0
 
H-SCAuthor Commented:
jindalankush,

Can you provide the code that would filter and fill the data?
0
 
RiteshSompuraCommented:
Following code snippet may give you some idea.
dim tempView as Data.DataView
 
tempView = New Data.DataView(myDataSet.Tables("myTable"))
tempView.RowFilter = "ctl_num = " + comboBox.Text
 
'fill values into textboxes here.
TextBox1.Text = TempView(0).Item("Field1").ToString()

Open in new window

0
 
jindalankushCommented:
for fiter u can use rawfilter as RiteshSompura: has said
0
 
H-SCAuthor Commented:
RiteshSompura,

Perfect!  That works great.  The only problem that I will have is that I will have to reference all of my many data fields in the code.. which there are many.  But this will work fine.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now