Connecting Tech Pros Worldwide Forums | Help | Site Map

DateTimePicker with ADO.NET

Newbie
 
Join Date: Oct 2008
Posts: 2
#1: Oct 28 '08
My question is--
when i select a date in datetimepicker1 as check in date after that i select
a date in datetimepicker2 as check out date then i want to show total days
difference between datetimepicker1 and datetimepicker2 in textbox1.
I am using ADO.NET

Newbie
 
Join Date: Oct 2008
Posts: 2
#2: Oct 28 '08

re: DateTimePicker with ADO.NET


My question is--
when i select a date in datetimepicker1 as check in date after that i select
a date in datetimepicker2 as check out date then i want to show total days
difference between datetimepicker1 and datetimepicker2 in textbox1.
I am using ADO.NET and SQL2005.
I want to coding for this .
My project is Hotel
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#3: Oct 28 '08

re: DateTimePicker with ADO.NET


ADO.NET are the data objects, so I'm not sure what you mean when you say you are using ADO for this. Also, the fact that you are using Sql 2k5 for this isn't important to your question either.

Is this a Forms app? It must be if you are using a DateTimePicker. Are you using C# or VB.NET? I guess that doesn't matter as much, because we aren't just going to do your work for you anyway.

OK, you can just handle the ValueChanged event of the second picker, and then get the Value from them. The property is .Value, and the type is DateTime. Then you can .Subtract the first from the second. The result will be a timespan. Then get the days from the timespan. The property is .Days, and that's it.
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#4: Oct 28 '08

re: DateTimePicker with ADO.NET


Please don't double post your questions. If you made a mistake and need to change your question, you can click the Edit button to edit your post, or you can post your corrections in a reply to your original thread. If you can't find your original thread, click the "My Subscriptions" link near the top of the page. If you feel that your question has been overlooked, post a reply to it to "bump" it back to the top of the forum. We ask that you do this only once every 24 hours.

So there is no reason to double post. It makes it hard on the Experts and you to keep track of what help you've already been given.

Threads merged.

MODERATOR
Reply


Similar .NET Framework bytes