[RESOLVED] I need help converting modal to modeless dialog boxes
I am brand new at visual basic, and i have no clue what i am doing. i need help allowing the display of multiple dialog boxes as modeless.
This is my code, can someone please post a version that would allow this box to me modeless, and any other changes i would have to make. Thanks!
Quote:
Private Sub llFormA_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles llFormA.LinkClicked
Using NewFormA As New FormA
Dim result = NewFormA.ShowDialog()
End Using
End Sub
Re: I need help converting modal to modeless dialog boxes
i am using visual studio 2008
Re: I need help converting modal to modeless dialog boxes
Use the Show method instead. Note though that it would not block so you can't wait for a return value and you can't wrap it in an Using block. Instead you handle the FormClosing event and expose the value you wish to get as a public field in your dialog Form. You capture this value in the FormClosing event.
Re: I need help converting modal to modeless dialog boxes
Thanks for the help, but could you be a little more specific? i have no clue as to what i am doing with VB, the closest i have come is basic c++. When i tried using the Show method, instead of the ShowDialog method, it told me it had an error code."Error 4 Expression does not produce a value."
Re: I need help converting modal to modeless dialog boxes
Code:
Dim result = NewFormA.ShowDialog()
That is because of the part in red. If you use the show method then it will not wait for the return value so there is no return value. You have to use another method to get your result if you do not use the showdialog method. Such as mentioned in the post above using the closing event of the dialog form.
Re: I need help converting modal to modeless dialog boxes
Windows Systems do not allow you to have more than one Modal dialog open, because it waits for user input. Best way would be to use the methods described by Niya
Re: I need help converting modal to modeless dialog boxes
Thanks for the help, i figured it out. i wasent making the changes in the correct area, and forgot to remove the using command.
My new code is:
Code:
Dim NewFormA As New FormA
NewFormA.show()
and it works like a charm... 1 week in to learning vb and starting to make some progress
Re: I need help converting modal to modeless dialog boxes
That is great news!
Please mark your thread as resolved if you feel you have recieved your answer