Windows Develop Bookmark and Share   
 index > Windows Forms General > Date problem
 

Date problem

Hello,

I have  2 x datetimepickers and 1 x textbox
The datetimepickers are set to date in my MSaccess database the textbox is for a calculation.

I am trying to calculate (datetimepicker1) - (datetimepicker2) = textbox

I am unsure how to calculate dates.  A few different things I have tried give me an error about converting strings to LONG.

Does anyone know how this should be coded.

Thanks
Peter
MigrationUser 1  Thursday, October 28, 2004 11:20 PM
DateTime date1 = ...;
DateTime date2 = ...;
TimeSpan t = date2.Subtract(date1);
MigrationUser 1  Friday, October 29, 2004 3:13 AM
Thanks Daniel,
for the working solution.

regards
Peter
MigrationUser 1  Friday, October 29, 2004 4:49 PM

You can use google to search for other answers

Custom Search

More Threads

• Drag And Drop events
• dynamically add tabpages with listviews to tabcontrol
• Separate opacities in MSVC++.NET
• ListView - scroll bars.
• Save all controls name and value on WinForm
• Problem with DataGridViewComboBoxColumn - DropDown list is black, I don`t know why.
• Different connection string for different configuration
• Ideas Appreciated
• Get internet explorer address bar text
• is it possible to restrict qty of app instances that client can open