disable monthcalendar refresh

S

steven

A monthcalendar checks every 2 minutes if theres a new day. Does anyone
knows how to disable this ?

The problem is that, everytime a monthcalendar checks this, the form
where the monhcalendar is on, gets the focus, which is VERY annoying.


Thanks,

Steven
 
C

Cor Ligthert

Steven,

I have now 5 minutes a montcalandar on my screen which not has the focus,

Why not try it yourself with a new project with only a textbox and a
monthcalander and set than the focus on the textbox.

I am curious about the reason by the way.

I hope this helps anyway to find your problem?

Cor
 
H

Herfried K. Wagner [MVP]

steven said:
A monthcalendar checks every 2 minutes if theres a new day. Does anyone
knows how to disable this ?

The problem is that, everytime a monthcalendar checks this, the form where
the monhcalendar is on, gets the focus, which is VERY annoying.

I am not able to repro that using .NET 1.0 on Windows XP Professional SP2.
 
S

steven

Herfried said:
I am not able to repro that using .NET 1.0 on Windows XP Professional SP2.
Hi,

I forgot to mention: my application exist of more than 1 form. I've
tried to begin a new application, and the problem persist.

When a form without the monthcalendar has the focus, at a certain
moment, the form with the monthcalendar gets the focus!

Any solutions ?

Thanks,

Steven
 
S

steven

Cor said:
Steven,

I have now 5 minutes a montcalandar on my screen which not has the focus,

Why not try it yourself with a new project with only a textbox and a
monthcalander and set than the focus on the textbox.

I am curious about the reason by the way.

I hope this helps anyway to find your problem?

Cor
Hi,

I forgot to mention: my application exist of more than 1 form. I've
tried to begin a new application, and the problem persist.

When a form without the monthcalendar has the focus, at a certain
moment, the form with the monthcalendar gets the focus!

Any solutions ?

Thanks,

Steven
 
H

Herfried K. Wagner [MVP]

steven said:
I forgot to mention: my application exist of more than 1 form. I've tried
to begin a new application, and the problem persist.

When a form without the monthcalendar has the focus, at a certain moment,
the form with the monthcalendar gets the focus!

My test application also had two forms, one containing the MonthCalendar.
 
C

Cor Ligthert

Steven,

I made 2 forms on form2 a calendar than this code in form1

\\\
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim frm As New Form2
frm.Show()
End Sub
///

And setted by hand the focus back to form1

I did not see in 2 minutes a change of focus.

How do you do this to simulate this?

Cor
 
S

steven

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top