Passing value from the form
-
When I'm using the following code, everything is Okay.
DateTime startDate = DateTime.Parse("05/01/2007");
DateTime endDate = DateTime.Parse("06/01/2007");But when I try to pass the date value directly from the text box, it gives me error. How can I pass the date directly into the code from textbox. Any suggestions. Thanks
-
When I'm using the following code, everything is Okay.
DateTime startDate = DateTime.Parse("05/01/2007");
DateTime endDate = DateTime.Parse("06/01/2007");But when I try to pass the date value directly from the text box, it gives me error. How can I pass the date directly into the code from textbox. Any suggestions. Thanks
-
When I'm using the following code, everything is Okay.
DateTime startDate = DateTime.Parse("05/01/2007");
DateTime endDate = DateTime.Parse("06/01/2007");But when I try to pass the date value directly from the text box, it gives me error. How can I pass the date directly into the code from textbox. Any suggestions. Thanks
Try putting the value from the textbox into a temporary variable and see what it is by debugging your application. Also, try to read the exception that has been thrown to see what it is.
Deja View - the feeling that you've seen this post before.
-
DateTime startDate = DateTime.Parse(textBox.Text); :confused: If that doesn't work, what's the error
-
Eh? This would say that you were using the DateTime and not the TextBox.
Deja View - the feeling that you've seen this post before.
-
Try putting the value from the textbox into a temporary variable and see what it is by debugging your application. Also, try to read the exception that has been thrown to see what it is.
Deja View - the feeling that you've seen this post before.
This was exactly what I tried b4 posting. I stored the value from textbox into a String variable and then Parsed it into DateTime as it's shown in the code. But all this time I was getting errors b'coz the name of my Textbox was same as that of the variable I used for used for storing the date. So,
I changed the variable name and its UP and RUNNING.
Thanks a lot to everyone :)