The drop-down form below includes option buttons and button controls for the user to make a selection from the C1DropDownControl.
The drop-down form appearance properties have been edited so that the form appears as below:
Select the form class name (for this example, WindowsApplication1.DropDownForm1) in the DropDownFormClassName property of your C1DropDownControl. Notice that when you run the project and select the drop-down arrow, the drop-down form now appears.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub DropDownForm1_PostChanges(sender As Object, e As System.EventArgs) If (MyBase.DialogResult = DialogResult.OK) Then Dim control1 As Control For Each control1 In MyBase.Controls If (TypeOf control1 is RadioButton AndAlso CType(control1, RadioButton).Checked) Then MyBase.OwnerControl.Value = CType(control1, RadioButton).Text End If Next End If End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void DropDownForm1_PostChanges(object sender, System.EventArgs e) { if (DialogResult == DialogResult.OK) { foreach (Control control1 in Controls) { if (control1 as RadioButton != null && ((RadioButton)control1).Checked) { OwnerControl.Value = ((RadioButton)control1).Text; } } } } |
Your form should appear similar to the form below: