Complete Info from a Dialog Box

G

Guest

I have a dialog box that I have several groups of radio buttons on for the
selection of different operations. These are in addition to the "OK" and
"Cancel" buttons. I have no trouble getting the info back on the buttons but
I have been unable to get info back on the selected radiobuttons. I have
tried several different methods. I have determined that my global variables
do not get passed to the Dialog Box even though it is called by the main
form. It appears to be autonomous as far as the code is concerned except for
the single return link of "DialogResult.___" (.OK or .Cancel, etc.).

Thanks any help would be appreciated,
 
P

Phillip Taylor

I have a dialog box that I have several groups of radio buttons on for the
selection of different operations. These are in addition to the "OK" and
"Cancel" buttons. I have no trouble getting the info back on the buttons but
I have been unable to get info back on the selected radiobuttons. I have
tried several different methods. I have determined that my global variables
do not get passed to the Dialog Box even though it is called by the main
form. It appears to be autonomous as far as the code is concerned except for
the single return link of "DialogResult.___" (.OK or .Cancel, etc.).

Thanks any help would be appreciated,

Perhaps posting some code of what you are doing would help but
normally the process for working with a model dialog is like this:

myVariable1 as Boolean
myVariable2 as Boolean

public sub button1_Click() '<-- this isn't under the dialog, it's
the code that opens the dialog.

'create the dialog
Dim frmDlg As New Form()

'set any default values on the dialog
frmDlg.checkbox1.checked = True

'show the dialog box in a model view (so user's must ok it)

Dim usersResponse As DialogResult = frmDlg.ShowDialog()

'if the result was OK then update the data, else just ignore
it.
If (usersResponse = Windows.Forms.DialogResult.OK) Then
myVariable1 = frmDlg.checkbox1.checked '<--
read the value from the dialog directly.
myVariable2 = frmDlg.radiobutton1.checked
End If

end sub

Hope this helps,

Phill
 
G

Guest

Thank you, this is what I needed. I don't why something like this is not
detailed in the books I have. I have the microsoft step by step guide
(Halvorson) and another thick one on programming of VB .NET with Peter Aitken
but neither of them explained the operation. I appreciate you help. Is
there another book you might suggest.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top