-
October 29th, 2012, 12:42 PM
#1
[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!
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
-
October 29th, 2012, 01:13 PM
#2
Re: I need help converting modal to modeless dialog boxes
i am using visual studio 2008
-
October 29th, 2012, 07:54 PM
#3
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.
-
October 30th, 2012, 12:06 PM
#4
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."
-
October 31st, 2012, 06:50 PM
#5
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.
Always use [code][/code] tags when posting code.
-
November 1st, 2012, 07:14 AM
#6
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
-
November 1st, 2012, 03:30 PM
#7
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
-
November 2nd, 2012, 01:56 AM
#8
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|