quick5pnt0
Member
- Joined
- Oct 1, 2008
- Messages
- 9
- Programming Experience
- Beginner
Hello, this is my first post here.
I'm trying to learn VB using VB 2008 Express Edition. My currently project is a stopwatch type of program but I need a little help with something. Part of my program requires me to convert a string which is held in a label and put it into a variable which is set as a DateTime. The label has a time in it in this format "00:00.000" (minutes, seconds, milliseconds).
I was told that I could use the Cdate function for this but I'm not inputting a string such as "August 12, 2004" I'm actually trying to pass the contents of a label like this: startime = CDate(label1.text) but unfortunately I get this error: "Conversion from string "00:02.250" to type 'Date' is not valid"
I was also told that I could use Convert.ToDateTime like this: Convert.ToDateTime(Label1.Text) but get this error: "String was not recognized as a valid DateTime"
I think the problem is that the functions aren't recognizing the 00:00.000 format as a valid date/time. Does anyone know a solution for this?
I'm trying to learn VB using VB 2008 Express Edition. My currently project is a stopwatch type of program but I need a little help with something. Part of my program requires me to convert a string which is held in a label and put it into a variable which is set as a DateTime. The label has a time in it in this format "00:00.000" (minutes, seconds, milliseconds).
I was told that I could use the Cdate function for this but I'm not inputting a string such as "August 12, 2004" I'm actually trying to pass the contents of a label like this: startime = CDate(label1.text) but unfortunately I get this error: "Conversion from string "00:02.250" to type 'Date' is not valid"
I was also told that I could use Convert.ToDateTime like this: Convert.ToDateTime(Label1.Text) but get this error: "String was not recognized as a valid DateTime"
I think the problem is that the functions aren't recognizing the 00:00.000 format as a valid date/time. Does anyone know a solution for this?