-
Dec 15th, 2014, 07:41 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Filtering datagrid data from textbox input
Hi there, I have been away from programming for a while, so cannot quite remember how to filter a data grid using a textbox. Below is the code that I have (but throws an error):
TestFilterdatagridBindingSource.Filter = "FlightPlan Code ='" & TextBox1.Text & "'"
Can anyone please help with this?
-
Dec 15th, 2014, 07:48 PM
#2
Re: Filtering datagrid data from textbox input
try:
Code:
TestFilterdatagridBindingSource.Filter = "[FlightPlan Code] ='" & TextBox1.Text & "'"
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Dec 15th, 2014, 07:49 PM
#3
Re: Filtering datagrid data from textbox input
if it's a numeric field, don't use the surrounding '
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Dec 15th, 2014, 07:54 PM
#4
Thread Starter
Addicted Member
Re: Filtering datagrid data from textbox input
Thanks for reply, but I still get a error:
-
Dec 15th, 2014, 07:56 PM
#5
Re: Filtering datagrid data from textbox input
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Dec 15th, 2014, 07:58 PM
#6
Re: Filtering datagrid data from textbox input
that would be:
Code:
TestFilterdatagridBindingSource.Filter = "[FlightPlan Code] =" & TextBox1.Text
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Dec 15th, 2014, 08:03 PM
#7
Thread Starter
Addicted Member
Re: Filtering datagrid data from textbox input
Yes, but still not liking this without the surrounding '
I am at a loss here??
-
Dec 15th, 2014, 08:06 PM
#8
Re: Filtering datagrid data from textbox input
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Dec 15th, 2014, 08:18 PM
#9
Thread Starter
Addicted Member
Re: Filtering datagrid data from textbox input
This still gets an error:
-
Dec 15th, 2014, 08:21 PM
#10
Thread Starter
Addicted Member
Re: Filtering datagrid data from textbox input
This is the last code I tried:
TestFilterdatagridBindingSource.Filter = "[FlightPlan Code] =" & TextBox1.Text
-
Dec 15th, 2014, 08:36 PM
#11
Re: Filtering datagrid data from textbox input
At the time that you clicked the button, what was TextBox1.Text?
If it was "" that would explain the error
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Dec 15th, 2014, 08:40 PM
#12
Thread Starter
Addicted Member
Re: Filtering datagrid data from textbox input
Originally Posted by .paul.
At the time that you clicked the button, what was TextBox1.Text?
If it was "" that would explain the error
The contents of textbox1.text contains a test number of "1234"
-
Dec 15th, 2014, 08:43 PM
#13
Re: Filtering datagrid data from textbox input
If you need "" to equal all records, try:
TestFilterdatagridBindingSource.Filter = "[FlightPlan Code] LIKE " & If(TextBox1.Text = "", "%", TextBox1.Text)
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Dec 15th, 2014, 08:47 PM
#14
Thread Starter
Addicted Member
Re: Filtering datagrid data from textbox input
Thanks for your help, my mistake, I missed the fact that I had changed the textbox1 to textbox3. you were correct textbox1 had NO contents.
Really sorry to waste your time, and thanks for your help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|