Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all , how can I filter my grdiview by date from a textbox?
I know there are tons of tutorials in here for that but I have only come across
Web application example how can I do that given I have gridview, textbox where I enter the "date" and it should filters as required.
Thanks for any advice
Julie.
Posted
Updated 2-Apr-15 8:37am
v3
Comments
sudevsu 2-Apr-15 16:20pm    
Did you Datagridview from toolbox in Windows Forms application?
sudevsu 2-Apr-15 16:25pm    
Also share what you have tried.
murkalkiran 3-Apr-15 5:11am    
why your using textbox instead you can use datetimepicker in windows application
Julia Fraveau 3-Apr-15 5:34am    
Hi@ murkalkiran please how can i implement that?
sudevsu 3-Apr-15 8:57am    
Julia, In the toolbox, instead of Textbox use DateTimepicker. If you drag and drop the datetimepicker and change the ID dtStart.
Then if you change the date from the form, it can stored in a string or Date variables like "dtStart.Value"

1 solution

Hey Julia,I just solved this problem my self with the help of "@George Jonsson" here on this site, so go to this link and see how I did mine using dateTimePicker and just follow suit ,you should be fin Ok:))
ow to filter DataGridView by dateTimePicker[^]>
 
Share this answer
 
Comments
Julia Fraveau 4-Apr-15 11:00am    
Thanks @Ekona_Pikin let me get on it.
Julia Fraveau 4-Apr-15 11:05am    
Hey Ekona_Pikin on your method to select did you put the code in a button_click or where?
Ekona_Pikin 4-Apr-15 11:10am    
Yea goto to toolbox and grab dateTimePicker1, click on it and paste the method you would be using to connect to your database and what ever you want to do including your select statement as seen in mine,Note if you are using access DB instead of '{0:}'<== use #{0}# and you should be set.
Julia Fraveau 4-Apr-15 11:19am    
Yay!!! works thanks I guess I will say thanksboth @George Jonsson and Ekona_Pikin works perfect actually I used the of "MM/dd/yy HH:mm" since my date field in my DB was in a military Time format so works great:))))
Ekona_Pikin 4-Apr-15 11:26am    
Great, glad is working for you too.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900