dialog?!?!

Macaco

Freshman
Joined
Jul 5, 2004
Messages
39
hello,


I have a form and a dialog with 2 checkbuttons inside, and a OK button, I want the form to open the dialog and when the user checks one of the checkbuttons and clics ok he returns to the form and I know which check button has he pressed.

How can I do that???? how to open the dialog box from the form? how to know which check button has he pressed???


thanks
 
You've gotta save the setting, things are done automatically for you. Generally if it's such small settings you'd save it as a Registry value, Lookup how to make registry keys on google, or if you're using VB, you can opt to use the SaveSettng and GetSetting keywords. Some people also opt to save these settings to an actual file, generally XML formated.
 
You can also reference the child form through a pointer in the form that created it.

Visual Basic:
private sub ShowSomeDialog()
   dim newDialog as new CheckBoxDialog   'assuming checkboxdialog is the one you
                                                         ' want the info from

   newDialog.ShowDialog(me)   'makes it a modal call, the form waits until newDialog
                                          'returns, in this case, closes or hits OK

   dim checkOne as Boolean = newDialog.CheckBox1.Checked  'gets the value of checkbox1.checked
   dim checkTwo as Boolean = newDialog.CheckBox1.Checked 'and number two

   newDialog.Close()
End Sub

And in the dialog you will want to override the OnClosing event and hide the dialog with a Me.Hide(). Also when the user hits the OK button, all you do is Me.Hide(). Check out these formus for info on how to override the OnClosing event.

This way you can do everything within the program and you don't have to save anything to a file or the registry.
 
Back
Top