473,586 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Modal dialogs hang up my program

Hello there,

I've encountered some strange behaviour. I display modal dialogs (using
ShowDialog) called from my mainform.
This is how the mainform is displayed out of the main sub of a module:
[vb]
Public fMain As frmMain

Public Sub Main()
Try
fMain = New frmMain
System.Windows. Forms.Applicati on.Run(fMain)
Catch ex As Exception ' line c
MsgBox(ex.Messa ge)
End Try
End Sub
[/vb]
and the modal dialog in frmMain:
[vb]
Private Sub MnuExtrasSettin gsClick(sender As System.Object, _
e As System.EventArg s)

Try
Dim fSettings As New frmSettings
If fSettings.ShowD ialog(Me) = DialogResult.OK Then ' Line a
' settings changed, load anew
LoadSettings(Fa lse)
End If
Catch ex As Exception
MsgBox(ex.Messa ge)
End Try
End Sub ' Line b
[/vb]
The dialog appears, but when close the button (whether with the OK or
Cancel-Button), the dialog closes and my app, too. The exception handler
of the main module displays "An external component raised an exception".
When I debug the prog, Line a displays the dialog, but when I close it,
jumps to Line b, and then to Line c (first source).
What am I doing wrong? (Accept- and CancelButton-properties of
frmSettings and the DialogResult-properties of the buttons are set).

When I copy the source from MnuExtrasSettin gsClick to a timer tick event
and call it from MnuExtrasSettin gsClick (Timer.Enabled = True), the
program does not crash.

What's wrong? I just don't understand it.
Thanks in advance,

Stefan

--
_______________ _______________ _____www.VBTric ks.de.vu
the free resource for Visual Basic, Gambas and Pascal
components, tips & complete projects

www: http://www.VBTricks.de.vu
mail: vbtricks <at> gmx <dot> net
_______________ _______________ _______________ ________
Nov 21 '05 #1
1 1397
Hi,

I usually dont specify an owner when I use show dialog.

If fSettings.ShowD ialog() = DialogResult.OK Then

Ken
---------------------
"VBTricks.d e.vu Webmaster" <no****@thisser verdoesntexist. com> wrote in
message news:OK******** ******@TK2MSFTN GP12.phx.gbl...
Hello there,

I've encountered some strange behaviour. I display modal dialogs (using
ShowDialog) called from my mainform.
This is how the mainform is displayed out of the main sub of a module:
[vb]
Public fMain As frmMain

Public Sub Main()
Try
fMain = New frmMain
System.Windows. Forms.Applicati on.Run(fMain)
Catch ex As Exception ' line c
MsgBox(ex.Messa ge)
End Try
End Sub
[/vb]
and the modal dialog in frmMain:
[vb]
Private Sub MnuExtrasSettin gsClick(sender As System.Object, _
e As System.EventArg s)

Try
Dim fSettings As New frmSettings
If fSettings.ShowD ialog(Me) = DialogResult.OK Then ' Line a
' settings changed, load anew
LoadSettings(Fa lse)
End If
Catch ex As Exception
MsgBox(ex.Messa ge)
End Try
End Sub ' Line b
[/vb]
The dialog appears, but when close the button (whether with the OK or
Cancel-Button), the dialog closes and my app, too. The exception handler
of the main module displays "An external component raised an exception".
When I debug the prog, Line a displays the dialog, but when I close it,
jumps to Line b, and then to Line c (first source).
What am I doing wrong? (Accept- and CancelButton-properties of
frmSettings and the DialogResult-properties of the buttons are set).

When I copy the source from MnuExtrasSettin gsClick to a timer tick event
and call it from MnuExtrasSettin gsClick (Timer.Enabled = True), the
program does not crash.

What's wrong? I just don't understand it.
Thanks in advance,

Stefan

--
_______________ _______________ _____www.VBTric ks.de.vu
the free resource for Visual Basic, Gambas and Pascal
components, tips & complete projects

www: http://www.VBTricks.de.vu
mail: vbtricks <at> gmx <dot> net
_______________ _______________ _______________ ________
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2842
by: Andrew Baker | last post by:
OK this has me perplexed, puzzled and bamboozled! I have a remoting service which I displayed a message box in. I then wondered what would happen if a client made a call to the service while the message box was being displayed. Since the call comes in on a different thread the client call was not blocked. This seemed to make sense to me. ...
10
2743
by: Guadala Harry | last post by:
I have a modal dialog that currently does all of the following except item 4. 1. lets users select a graphic from a list of thumbnails (and when selected, displays the full-size image in a preview DIV) 2. when users close the dialog, the application receives the URL to the selected graphic. 3. the modal dialog lets the users upload a new...
1
1384
by: wendy | last post by:
I have got a problem while using the modal dialogs. In my code I need to open a modal dialog from the parent page and I need to enter some values in the dialog and save it. It takes the values properly and also does the validation of the values but it doesn't hit the event handler of the button where it is supposed to save those values and...
2
3676
by: sthrudel | last post by:
Hi! I'm working on a web application in Asp.net and what I would like to have is a cross borwser modal dialog which accepts user's input. I would like to catch what the user clicked on the dialog. To be more specific I want to have a confirmation dialog that is shown when a user clicks on a Delete button (which deletes some values from...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.