473,320 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

filtering dataset

hi

how can i filter my dataset using the value of my combo box

thnks

Nov 20 '05 #1
2 1153
Hi Resti,

You can use a DataView:

- Set the combo box's DataSource to the DataTable in the DataSet.
- Set the combo box's DisplayMember property to the appropriate column name
in the DataTable.
- Add a DataView to the form, and set its Table property to the same
DataTable as the combo box's DataSource.
- Bind all controls (except for the combo box) to the DataView.
- In the SelectedIndexChanged event handler for the combo box, change the
DataView's RowFilter property, so that the combo box's DisplayMember is set
to the selected value. For example:

DataView1.RowFilter = "ProductName = '" & ComboBox1.SelectedText & "'"

The BindingContext will automatically refresh the controls that are bound to
the DataView.

Take care,

Eric


"resti" <an*******@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
hi,

how can i filter my dataset using the value of my combo box.

thnks,

Nov 20 '05 #2
Hi resti,

You can try this, watch for typos typed here
\\\
dim dv as new dataview = dt.tables(0)
dv.rowfilter = "Myfield = " & combobox1.text
///

I hope this helps?

Cor

how can i filter my dataset using the value of my combo box.

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alex Ayzin | last post by:
Hi, I have a problem that might be easy to solve(possibly, I've just overlooked an easy solution). Here we go: I have a dataset with 2 datatables in it. Now, I need to do the following: if...
3
by: serge calderara | last post by:
Dear all, I have a csv file data which has been read and populate on a dataset object. then I need to bind part of the content of the dataset to a treeview control. I have read that XML format...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
0
by: Jenny C. | last post by:
Hi I am trying to do a SUM on a DataSet column with the following code // ds is the DataSet that I need to calculate data fro String filter2 = "EmpNo = " + this.EmpNo + " AND WEEK_ENDING >= '"...
2
by: Marco Ippolito | last post by:
I have an offline DataSet: id (PK, sorted ASC), firstname, enabled 1, Aaron, true 2, Bill, false 3, Charlie, true .... 10001, Mike, false 10002, Nathan, false
0
by: ber.janssens | last post by:
Hi, I am trying the new ObjectDataSource from ASP.NET 2.0. I connected a Gridview with ObjectDataSource which is connected to a webservice which returns a DataSet. In the Webmethod I return...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
5
by: LDD | last post by:
Hi Folks I'm trying to determine a way to handle paging, filtering and sorting in a datagrid. If I choose to filter and sort, I'd like to return a subset. If that resultset has more records...
2
by: Jason Huang | last post by:
Hi, I use the ReadXML method in my C# Windows Form project. Here is some of my C# code: xmlDS.ReadXml(curDir + "\\Dept.xml") ; There're 20 rows and 5 columns in the Dept.xml. But now I just...
3
by: Shawn Ramirez | last post by:
As with most web applications speed is a huge deal to me in my applications. My customers don't really care if my app is a true 3 tier application or not, they just want it to be faster then it was...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.