By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,221 Members | 1,234 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,221 IT Pros & Developers. It's quick & easy.

bindingsource.filter

P: n/a
Is there a way to perform a bindingsource.filter on multiple inputs? For
example: I would like the user to be able to put something like <Smith,
Jones, Gates> into a textbox and have the datagridview filter the lastname
column to just those entries.

My code is simple right now:

dim strFilterLastName as string = me.txtbxLastName.text

me.qryWorkListBindingSource.Filter = "empnamLastName ='" & strFilterLastName
& "'"

Thank you for any advice.
Jun 6 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
If memory serves me well, the filter expression can follow the same rules as
the DataColumn.Expression property. The following MSDN reference for that
property has the complete reference on the rules for the filtering
expression:

http://msdn.microsoft.com/library/de...ssiontopic.asp

Note that you can AND expressions together.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Development Numbskull

Nyuck nyuck nyuck
"mafandon" <ma******@discussions.microsoft.com> wrote in message
news:F0**********************************@microsof t.com...
Is there a way to perform a bindingsource.filter on multiple inputs? For
example: I would like the user to be able to put something like <Smith,
Jones, Gates> into a textbox and have the datagridview filter the lastname
column to just those entries.

My code is simple right now:

dim strFilterLastName as string = me.txtbxLastName.text

me.qryWorkListBindingSource.Filter = "empnamLastName ='" &
strFilterLastName
& "'"

Thank you for any advice.

Jun 6 '06 #2

P: n/a
I've been playing with the AND operator. I get a "Cannot perform 'And'
operation on system.boolean and system.string." error when I do so.

Using the code below, I'll type <Smith' AND 'Jones> into the textbox and get
the error. Note the single quotes are there for the code to interpret.

"Kevin Spencer" wrote:
If memory serves me well, the filter expression can follow the same rules as
the DataColumn.Expression property. The following MSDN reference for that
property has the complete reference on the rules for the filtering
expression:

http://msdn.microsoft.com/library/de...ssiontopic.asp

Note that you can AND expressions together.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Development Numbskull

Nyuck nyuck nyuck
"mafandon" <ma******@discussions.microsoft.com> wrote in message
news:F0**********************************@microsof t.com...
Is there a way to perform a bindingsource.filter on multiple inputs? For
example: I would like the user to be able to put something like <Smith,
Jones, Gates> into a textbox and have the datagridview filter the lastname
column to just those entries.

My code is simple right now:

dim strFilterLastName as string = me.txtbxLastName.text

me.qryWorkListBindingSource.Filter = "empnamLastName ='" &
strFilterLastName
& "'"

Thank you for any advice.


Jun 6 '06 #3

P: n/a
Neither "Smith" nor "Jones" is an expression. However, the following would
work:

LastName = 'Smith' OR LastName = 'Jones'

That is the ORing of 2 expressions.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

A lifetime is made up of
Lots of short moments.

"mafandon" <ma******@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
I've been playing with the AND operator. I get a "Cannot perform 'And'
operation on system.boolean and system.string." error when I do so.

Using the code below, I'll type <Smith' AND 'Jones> into the textbox and
get
the error. Note the single quotes are there for the code to interpret.

"Kevin Spencer" wrote:
If memory serves me well, the filter expression can follow the same rules
as
the DataColumn.Expression property. The following MSDN reference for that
property has the complete reference on the rules for the filtering
expression:

http://msdn.microsoft.com/library/de...ssiontopic.asp

Note that you can AND expressions together.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Development Numbskull

Nyuck nyuck nyuck
"mafandon" <ma******@discussions.microsoft.com> wrote in message
news:F0**********************************@microsof t.com...
> Is there a way to perform a bindingsource.filter on multiple inputs?
> For
> example: I would like the user to be able to put something like <Smith,
> Jones, Gates> into a textbox and have the datagridview filter the
> lastname
> column to just those entries.
>
> My code is simple right now:
>
> dim strFilterLastName as string = me.txtbxLastName.text
>
> me.qryWorkListBindingSource.Filter = "empnamLastName ='" &
> strFilterLastName
> & "'"
>
> Thank you for any advice.


Jun 7 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.