bindingsource.filter

pierrewhy

Member
Joined
Oct 4, 2005
Messages
14
Programming Experience
5-10
I'm trying to filter by HouseNo "String" and RequestNo "Integer"
I've tried all kind of way and nothing work.
VB.NET:
[SIZE=2]TypeOfRenoBindingSource.Filter = [/SIZE][SIZE=2][COLOR=#a31515]"HouseNumber like '"[/COLOR][/SIZE][SIZE=2] + HouseNo + [/SIZE][SIZE=2][COLOR=#a31515]" ' " AND " [SIZE=2][COLOR=#008000][SIZE=2][COLOR=#a31515]"RequestNumber = " ' "[/COLOR][/SIZE][SIZE=2][COLOR=#000000] + RequestNo + [/COLOR][/SIZE][SIZE=2][COLOR=#a31515]" ' "[/COLOR][/SIZE]
[/COLOR][/SIZE][/COLOR][/SIZE]



Help please.

Thanks,
Pierre
 

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,053
Programming Experience
10+
.Filter = string.Format("[HouseNumber] LIKE '{0}%' And [RequestNo] = {1}", houseNo, requestNo)


Thats how we build multipart strings now. We dont continuously start and stop the string ("a" & b & "c" & d & " e") becuase it looks a MESS!

+ is NOT the operator for string concat in VB. you dont use string concat when you use string.Format, but if you ever do perform string concat (not in this case), use &
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
Thanks cjard but I was in a roundabout way trying to say "give us more information" (to pierrewhy). You know, instead of saying "nothing work" tell us what happened. I thought this may get pierrewhy thinking about why it didn't work.

But thanks for the info.
 

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,053
Programming Experience
10+
Thanks cjard but I was in a roundabout way trying to say "give us more information" (to pierrewhy). You know, instead of saying "nothing work" tell us what happened. I thought this may get pierrewhy thinking about why it didn't work.

Good call..

I do this from time to time.. Like when someone says "I'm getting an error of "abc" is not a valid Integer - why?" I also normally tell them to go and think about it, cause put it one way; if the compiler is so clearly leading the donkey to the water and it doesnt want to drink, then sure as heck you or I wont succeed without a lot of work ;)
 
Top Bottom