Choosing Date in MonthCalendar

toytoy

Well-known member
Joined
Jul 16, 2004
Messages
46
Programming Experience
1-3
Hi

can anyone tell me how to choose the date using MonthCalendar in form1 and display into a textbox in form2....

The problem is when i select to scroll to the other year, it will automatic display the date into the textbox in form2....
how to select from different years...

Below is my codes:

Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged
Dim AddInstance As New Adding

If (MonthCalendar1.SelectionStart.ToString <> "") Then
With AddInstance
.txtActivityDate.Text = MonthCalendar1.SelectionStart.ToString
.Show()
Me.Hide()
End With

End If
End Sub

Thanks
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
i can tell you why it autoselects a date when you move to another year/month, you've put this code into the DateChanged event now when you move to another year/month, it selects (by default) the same day as today in the different year/month, of which is a different date.

you could put the code into a button's click event so when the user is done selecting whatever date they need, they'll just click the button.
 
Top Bottom