B
bryan.a.fowler
I'm really new working with VB.net and I'm working on a simple program
with a date input. I've got a couple of questions;
1) I'm using a DateTimePicker to show both the user inputted date as
well as the calculated date. Is this a good way to do this or is there
an easier way?
2) I can't seem to get the code right to take the user inputted date to
output to the new calculated date. This is my code so far;
Dim MyDate As Date
Dim MyDate2 As Date
Dim CompDate As Date
Private Sub DateMyPick_ValueChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles DateMyPick.ValueChanged
'----Set Variable to this value----'
MyDate = DateMyPick.Value
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
MyDate2 = Convert.ToDateTime("MyDate"
CompDate = MyDate2.AddMonths(3)
DateCompPick.Value = CompDate
Is this about right or am I way off base? It compiles fine, but when I
go in, and actually click the button, I get an error message;
"An unhandled exception of type 'System.FormatException' occured in
mscorlib.dll Additional information: The stirng was not recognized as
a valid DateTime. There is an unknown word starting at index 0."
Any and all help would be greatly appreciated. Thanks!
with a date input. I've got a couple of questions;
1) I'm using a DateTimePicker to show both the user inputted date as
well as the calculated date. Is this a good way to do this or is there
an easier way?
2) I can't seem to get the code right to take the user inputted date to
output to the new calculated date. This is my code so far;
Dim MyDate As Date
Dim MyDate2 As Date
Dim CompDate As Date
Private Sub DateMyPick_ValueChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles DateMyPick.ValueChanged
'----Set Variable to this value----'
MyDate = DateMyPick.Value
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
MyDate2 = Convert.ToDateTime("MyDate"
CompDate = MyDate2.AddMonths(3)
DateCompPick.Value = CompDate
Is this about right or am I way off base? It compiles fine, but when I
go in, and actually click the button, I get an error message;
"An unhandled exception of type 'System.FormatException' occured in
mscorlib.dll Additional information: The stirng was not recognized as
a valid DateTime. There is an unknown word starting at index 0."
Any and all help would be greatly appreciated. Thanks!