Herfried said:
My test application also had two forms, one containing the MonthCalendar.
Try this code in your form with the monthcalendar (and an empty
datagrid) (Form2 is an empty form):
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim frm As Form
frm = New Form2
frm.Show()
End Sub
Private Sub MonthCalendar1_DateChanged(ByVal sender As Object,
ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles
MonthCalendar1.DateChanged
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add("test")
dr = dt.NewRow()
dr.Item("test") = "test: " + Now.ToShortTimeString
DataGrid1.DataSource = dt
End Sub
you'll see after a while (every 2 minutes), the function is being
called, and the datagrid is filled with the testdata. Within my
application, the focus of the form is set, but if I make a new
application, the form with the monthcalendar is not getting the focus
indeed. Anyway, disable the monthcalendar refresh will solve my problem.
Does anyone knows how to disable this monthcalendar refresh ? I've tried
to dynamically add/remove the handler from the monthcalendar, but that
didn't work.
Thanks,
Steven