Is there a way to launch a Modeless Dialog that stays active even when a Modal Dialog is launched? Can I put the Modeless Dialog in a seperate Thread or something like that?

Recommended Answers

All 6 Replies

Member Avatar for Unhnd_Exception

No.

Even if there is, that would take away all the logic of having a modal form.

You can show another form from the modal form if thats something you needed.

Both would be active at that point.

Set the form's owner your opening from the modal form to the modal form

my.forms.formx.showdialog

somewhere else in your code

my.forms.formy.owner = me
my.forms.formy.show

form y will stay on top of the modal form

Member Avatar for Unhnd_Exception

Try to be more clear

my.forms.formx.show dialog

somewhere else in formx's code call formy

my.forms.formy.owner = me 'formx
my.forms.formy.show

You'll have 2 active forms but can't return to the app until formx is closed.

"Even if there is, that would take away all the logic of having a modal form."

Unhnd_Exception,
Not exactly true. The old-style HelpFiles remained active and seperate even when Modal Forms were being displayed. I'm trying to accomplish something very similar. My entire application consists of Modal Forms and I need the one Modeless one to be active at all times...

Member Avatar for Unhnd_Exception

You may be able to expand on this

Create two buttons. Click button 2 first and that form will stay active after hitting button 1, which is modal


Public Class Form1
Private f2 As Form

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim f As New Form
f.ShowDialog()


End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim t As New Threading.Thread(AddressOf threadstart)
t.Start()

End Sub

Private Sub threadstart()
f2 = New Form
f2.ShowDialog()

End Sub
End Class

Member Avatar for Unhnd_Exception

Private Sub threadstart()
f2 = New Form
f2.topmost = true 'to keep it in front of the other forms
f2.ShowDialog()

Never could get it to respond correctly so I just ended up compiling the Form in question and calling it as an "exe" using the Shell command:

Shell(My.Application.Info.DirectoryPath & "/MyForm.exe", AppWinStyle.NormalFocus, False)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.