By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,267 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,267 IT Pros & Developers. It's quick & easy.

[urgent] MsgBox is non-modal.

P: n/a
js
Hi all,

I currently encounter a problem and it is urgent to me.

After calling the MsgBox.Show(), the message box is shown with non-modal
mode, what is the possible reason??? This only happen in the VB project,
works fine in C# project.

SystemModal and ApplicationModal MsgBoxStyle were all tried and there
was no help.

-jason



Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"js" <ja***@nospam.com> wrote in message
news:e9*************@TK2MSFTNGP11.phx.gbl...
Hi all,

I currently encounter a problem and it is urgent to me.

After calling the MsgBox.Show(), the message box is shown with non-modal mode, what is the possible reason??? This only happen in the VB project,
works fine in C# project.

SystemModal and ApplicationModal MsgBoxStyle were all tried and there
was no help.

-jason

Please show the code and circumstances. The default behavior of
MessageBox.Show() is to produce an application model message box, IME. I
also tested MsgBox() without incident. It, too, seems to default to
application modal.

--
Peter - [MVP - .NET Academic]
Jul 21 '05 #2

P: n/a
js
A similiar thread with more details was posted under
....dotnet.framework.winform group, below contains some useful information
that may help.

I also made a very simple usercontrol which could produce the problem,
please let me know if you need it.

-jason

--julie wrote--------

I have put the question in as a possible bug.
Will post back as soon as I have some info for you.
I have seen other issues posted about the valuechanged event and msgbox.
julie

"js" <ja***@nospam.com> wrote in message
news:%2*****************@TK2MSFTNGP11.phx.gbl...
Julie,

Yes, only the DateTimePicker has the issue. The reason I just choose
this control is I was constructing a custom dropdown control which I believe has the similar window relationship as the DateTimePicker control. My
customer reported the non-modal problem to me and I immediately checked the DateTimePicker, "luckily" it has the same problem.

I was trying to work around it but with no result, whatever both the
MsgBoxStyle.SystemModal and the MsgBoxStyle.ApplicationModal do not take
effect in this scenario. I have no idea whether this is a bug in the .NET
Framework.

Any .NET MVP could help?

-jason

"Julia Lerman" <TH**********************@thedatafarm.com> wrote in message
news:O8**************@TK2MSFTNGP11.phx.gbl...
Jason
You are partially right. I tried the datetimepicker and a few other
controls. So far it is only the date time picker that is ignoring the modal
state of the dialog box. Try a checkbox and put your msgbox in the
checkedChanged event or a button with a msgbox in the click event.

I could not find any info on this via google.

I will ask some more MVP's if they are familiar with this problem.

Julie Lerman
.NET MVP

"js" <ja***@nospam.com> wrote in message
news:u4**************@tk2msftngp13.phx.gbl...
Hi,

In some situation, the message box can not be shown in modal mode.

Please drop a DateTimePicker control on a Form (VB project), show a message box in the ValueChanged event, as below snippet. Now run the form and drop down the calendar, select a date to let the event fire, after the message box shown, we can still activate the form background. This happens whatever MsgBoxStyle is specified even as MsgBoxStyle.SystemModal.
Private Sub DateTimePicker1_ValueChanged(ByVal sender As Object, ByVal
e
As System.EventArgs) Handles DateTimePicker1.ValueChanged
MsgBox("DateTimePicker1_ValueChanged",

MsgBoxStyle.ApplicationModal)
End Sub
The same scenario could be reproduced in a C# project, but I could
pass it if by specifying the Form as the owner of the message box, as below code.
private void dateTimePicker1_ValueChanged(object sender, System.EventArgs
e)
{
MessageBox.Show(this, "dateTimePicker1_ValueChanged");
}

Is something wrong in the message box method in VB?


-jason



"Peter van der Goes" <p_**********@mars.cox.net> wrote in message
news:#j**************@TK2MSFTNGP11.phx.gbl...
"js" <ja***@nospam.com> wrote in message
news:e9*************@TK2MSFTNGP11.phx.gbl...
Hi all,

I currently encounter a problem and it is urgent to me.

After calling the MsgBox.Show(), the message box is shown with

non-modal
mode, what is the possible reason??? This only happen in the VB project,
works fine in C# project.

SystemModal and ApplicationModal MsgBoxStyle were all tried and

there was no help.

-jason

Please show the code and circumstances. The default behavior of
MessageBox.Show() is to produce an application model message box, IME. I
also tested MsgBox() without incident. It, too, seems to default to
application modal.

--
Peter - [MVP - .NET Academic]

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.