Default Value For Combobox

Discussion in 'AutoCAD' started by stck2mlon, May 7, 2004.

  1. stck2mlon

    stck2mlon Guest

    In this example, how do I make "Yes" the default vlue when the form starts. I have tried the book example for initialize form but do not see how it works in this example.

    Private Sub cmbBill_DropButtonClick()
    cmbBill.List() = Array("Yes", "No")
    'cmbBill.ListIndex = 0
    End Sub
     
    stck2mlon, May 7, 2004
    #1
  2. stck2mlon

    HJohn Guest

    You are correct, it works fine. Just remove the comment character from the third line.
     
    HJohn, May 7, 2004
    #2
  3. stck2mlon

    stck2mlon Guest

    It only seems to work once I click on the down arrow...I want it present when the dialog box first pops.
     
    stck2mlon, May 7, 2004
    #3
  4. stck2mlon

    HJohn Guest

    Change the code to the Initialize event, rather than the button click.
     
    HJohn, May 7, 2004
    #4
  5. stck2mlon

    Mark Propst Guest

    I think Hjohn meant something like:

    Private Sub UserForm_Initialize()
    cmbBill.List = Array("Test1", "Test2", "Test3")
    cmbBill.ListIndex = 0 '<---put this line here
    End Sub

    when he said uncomment the line and move it into the Initialize event
     
    Mark Propst, May 9, 2004
    #5
  6. stck2mlon

    Mark Propst Guest

    also, since I notice some of your questions are specfic to vb, rather than
    specific to autocad, are you also aware of
    microsoft.public.vb.general.discussion forum?
    there's lots of great help available there as well as here - (if your
    questions don't invole autocad specific issues)
     
    Mark Propst, May 9, 2004
    #6
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.