473,322 Members | 1,538 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,322 software developers and data experts.

bindingsource.filter

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
3 7587
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David McCrory | last post by:
Does anyone have a good example of using the Find() or Filter() methods of the BindingSource. I am binding to an array of objects and not having any luck getting these functions to work. ...
0
by: meska | last post by:
Hi all, anyone has ideas how to display on ReportViewer items filtered through BindingSource.Filter? Adding a BindingSource through ReportDataSource to LocalReport.DataSources doesn't...
1
by: mafandon | last post by:
Is it possible to filter a bindingsource twice? If I want to filter on gender, and filter on zip codes - can you do that with a bindingsouce.filter method? It always filters on the last filter...
0
by: mafandon | last post by:
It seems as nobody actually can tell me why or how this would work... When I filter my bindingsource just before redering a report, the report does not reflect the filter, but shows all records...
4
by: michael sorens | last post by:
I have successfully bound an XmlDocument to a DataGridView but all fields seem to be strings. I want to retrofit appropriate datatypes on some of the fields. Let me take this in 2 parts. Part...
0
by: =?Utf-8?B?VGVycnk=?= | last post by:
I have noticed the following behavior, which I believe is 'wrong'. I have a BindingSource that I am using to populate a datagrid, and I am using a DataView as the BindingSource.DataSource,...
0
nev
by: nev | last post by:
Hello all. I would like to place code when bindingsource is being filtered. I have tried placing it in the positionchanged and listchanged event. But, when I try to filter the bindingsource, it...
0
by: newcooler | last post by:
I have a junction table for instance 1 service can have many contacts - using a composite key junction table. what i want to do is to filter all the contacts that belong to the service using the...
1
by: =?Utf-8?B?Rm9lZg==?= | last post by:
I have a BindingSource with an underlying table with two primary keys. To set the position with one primary key works fine as shown in the code snippet below: Dim index As Integer =...
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.