Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys , I have facing the problem of differenciate of two DropDownList values. I was enter the values manually of both DropDownList.
The values are Time like
01:00
01:30
02:00
-----
-----
23:59
and also same as second DropdownList.


I want to difference of both. I will display in texbox of difference.

For example : differenciate from dropdown2 - dropdown1= 02:00 - 01:00 = 00:30 that is i want.
How to do this.

Please any one help me.
Posted
Updated 21-Aug-12 19:42pm
v6

here is an example,
VB
   Dim t1 As TimeSpan
   Dim dt2 As DateTime = Convert.ToDateTime("01/01/2001 02:00")
   Dim dt1 As DateTime = Convert.ToDateTime("01/01/2001 01:30")
   t1 = dt2.Subtract(dt1)
   Dim duration = t1.Hours.ToString("00") & ":" & t1.Minutes.ToString("00")
'02:00 - 01:30 = 00:30
'replace underline time value with dropdownlist.text
'eg. Convert.ToDateTime("01/01/2001 " & dropdown2.text)

Happy Coding!
:)
 
Share this answer
 
Comments
CH Guravaiah 21-Aug-12 8:21am    
Thank you
Aarti Meswania 21-Aug-12 8:24am    
welcome :)
First get the value of dropdownlists. Now those are in string format, so convert into DateTime then subtract.
 
Share this answer
 

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