Filtering on a datagrid

E

EMW

How can I based on certain settings, filter rows in a datagrid or dataset?
i.e. column 1: numbers 1 to 10
filter: show only odd numbers.

I've seen the dataview.rowFilter property but MSDN only tells me to put the
filter in a string, but not how the filter should look like.

rg,
Eric
 
E

EMW

sorry, I found it.

From now on I will first Google it, and then if I can't find it, post a
question here....
 
D

David Clegg

EMW said:
From now on I will first Google it, and then if I can't find it, post
a question here....

Another suggestion...
If you do find a solution to your problem, post it here so others may
benefit.

--
Cheers,
David Clegg
dclegg_at_ebetonline_dot_com
http://cc.borland.com/codecentral/ccweb.exe/author?authorid=72299

Quality Central. The best way to bug Borland about bugs.
http://qc.borland.com

"Without TV, it is hard to know when one day ends and another
begins." - Homer Simpson
 
E

EMW

I found out the following and it works too:

If you do RowFilter = "name = 'someone'" it will filter on all the names;
name is a columnname.
if you also want to add another column to filter in: use AND
i.e. RowFilter = "name = 'someone' AND address= 'somewhere'"

if you want to select on a date: you could do it like this:

Row filter = "(mydate >= '01-01-2004' AND mydate <= '31-12-2004')"
if will then filter column mydate to only show the rows where the date is in
the year 2004.
Ofcourse you can modify the date to be more specific.

If you want to filter the rows on which the cell of a column is not empty
then use this:

RowFilter = "IsNull(name,'')<>''" (Only the last and first quotes are
double ones, the rest are single)

I believe IsDate is also possible.


Hope I help someone with this.

rg,
Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top