Need help with option button event 
Author Message
 Need help with option button event

I am having trouble getting an event response when I use the "Add
Method" to add a control to a form.

I am using a "For ... Next" loop to add a group of option buttions to
the form and I am writing an event procedure to respond to a click
event.  I don't receive any errors, which seems to mean that the
compiler has accepted the procedure as valid.  But when I click on the
option button, nothing happens.

Can anyone show me the error of my ways?  I would appreciate any
assistance I can receive.

Code goes something like this ...

    For i = 1 To 10
    WhichControl = "CustomControl_" & i
    TypeControl = "VB.OptionButton"
    form_Main.Controls.Add TypeControl, WhichControl, form_Main!Frame1
    With form_Main(WhichControl)
        .Left = 2200
        .Width = 2500
        .Top =  300 * i
        .Visible = True
    End With
    Next i

And this ....

    Private Sub CustomControl_2_Click()
        'Do stuff here
    End Sub

Thanks,
Calvin



Mon, 30 Jun 2003 04:46:40 GMT  
 Need help with option button event
Why does everyone wont to use option buttons as "Fireing Buttons"

if u wish to go down that path then put code behing
Clikc...DBLClick...Keydown...KeyPress



Mon, 30 Jun 2003 06:11:11 GMT  
 Need help with option button event
Jared, et al

I'll use anything, value, etc., anything.

I'm trying to set the value of a combobox to enabled if the optionbox =
true.

Look at the code and I could use some suggestions.

Calvin

Quote:

> Why does everyone wont to use option buttons as "Fireing Buttons"

> if u wish to go down that path then put code behing
> Clikc...DBLClick...Keydown...KeyPress



Mon, 30 Jun 2003 07:54:08 GMT  
 Need help with option button event
Option Explicit

Private Sub Option1_Click()

    If Option1.Value Then Combo1.Enabled = True

End Sub

Private Sub Option1_KeyPress(KeyAscii As Integer)

    If Option1.Value Then Combo1.Enabled = True

End Sub



Mon, 30 Jun 2003 12:00:39 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Events on dynamic option buttons

2. How to get a click event from an option button that's already True

3. option button arrow key events

4. Needed to create a new option button at run time

5. Newbee needs to retrieve option button value from form

6. Option group/option button

7. Option Group/Option Button

8. Option Button - 2 buttons selected at once.

9. Working with an Option Button Array and Checkbox Button Array

10. Option buttons - using vba to determine selection - Help

11. Help with Option Buttons

12. Adding a button to an option box. HELP

 

 
Powered by phpBB® Forum Software