vba code help

Discussion in 'AutoCAD' started by Jason Wilder, Nov 5, 2004.

  1. Jason Wilder

    Jason Wilder Guest

    Ok, I'm trying to figure out something that I have a little trouble with.
    On my form, I have a frame for a selecting an option which has 2 check boxes
    in it. What I'm trying to do, is depending on which option is selected, all
    others in that frame are turned off and some settings are changed depending
    on which option is selected. I don't recall if there is a way to control
    this at the Frame, or if I'm correct in that the Click event for each
    checkbox has to change all settings on the form?

    I know the controls aren't the cleanest, and I was trying to strip them down
    a bit, but I'm having trouble clarifying control. I've tried different
    methods, but then I have to click a checkbox twice, once to clear the
    others, then once more to select it as True.

    Any pointers or something I'm just missing? Thanks for any help.

    Here are the Click controls for the only 2 options I have at the moment:


    Private Sub chkboxClientTB_TollBros_Click()
    If chkboxClientTB_TollBros.Value = True Then
    Frame_DwgScl.Enabled = False: Frame_DwgSize.Enabled = False:
    chkboxClientTB_GH.Value = False
    OptButton_24.Value = False: OptButton_30.Value = False:
    OptButton_48.Value = False: OptButton_64.Value = False
    ElseIf chkboxClientTB_TollBros.Value = False Then
    Frame_DwgScl.Enabled = True: Frame_DwgSize.Enabled = True
    OptButton_24.Value = True: OptButton_48.Value = True
    End If
    End Sub
    Private Sub chkboxClientTB_GH_Click()
    If chkboxClientTB_TollBros.Value = True Then
    Frame_DwgScl.Enabled = False: Frame_DwgSize.Enabled = False:
    chkboxClientTB_TollBros.Value = False
    OptButton_24.Value = True: OptButton_30.Value = False:
    OptButton_48.Value = True: OptButton_64.Value = False
    ElseIf chkboxClientTB_TollBros.Value = False Then
    Frame_DwgScl.Enabled = True: Frame_DwgSize.Enabled = True
    OptButton_24.Value = True: OptButton_48.Value = True
    End If
    End Sub
     
    Jason Wilder, Nov 5, 2004
    #1
  2. Jason Wilder

    bcoward Guest

    Jason,

    "What I'm trying to do, is depending on which option is selected, all others in that frame are turned off and some settings are changed depending on which option is selected."

    Option buttons in a control array might help you here thus getting rid of most of that code while meeting your other expectations.

    Toll Brothers aye - Oh good luck.
     
    bcoward, Nov 5, 2004
    #2
  3. Jason Wilder

    Oberer Guest

    "Option buttons in a control array might help you here thus getting rid of most of that code while meeting your other expectations."

    This would assume that you're using VB not VBA. if your in VBA, we don't really have control arrays, but we can fake them. you could name your controls chkOptions1 chkOptions2, etc. You'd then have to create a function and pass the control's name to it.
     
    Oberer, Nov 9, 2004
    #3
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 (here). After that, you can post your question and our members will help you out.