How do you code a Continue button on a Userform?

Discussion in 'AutoCAD' started by KCGalloway, Jun 7, 2004.

  1. KCGalloway

    KCGalloway Guest

    Hello,

    I am trying to create a Continue bottom in Userform1 that will start the whole program over.
    The program begins with the macros Sub Floorplan() which asks the user to select a starting point. This subroutine then calls UserForm1 which asks the user to type in the X and Y dimensions of a rectangle.
    After Userform1 draws the rectangle, I would like the user to have the option of selecting a another starting point without having to end the program, and run the macros program again.
    What commands do I need in the Continue button to make this work? Thank you.

    ~Kevin
     
    KCGalloway, Jun 7, 2004
    #1
  2. KCGalloway

    Norman Yuan Guest

    You can easily do this by show/hide the form:

    the steps for the program to work could be:

    1. Show your UserForm
    2. Ask user input start point:
    Either you can have two textboxes for user to type in, or put a button
    with caption "Pick >", or you can have both on the form. I'd guess your CAD
    user will like picking point more than typing in numbers.
    3. When user click "Pick >" button, you can put code like this

    Private Sub cmdPick_Click()
    'Hide userform
    Me.Hide

    Dim pt As Variant
    pt=ThisDrawing.Utility.GetPoint(, vbcr & "Pick START POINT: ")

    'Then draw whatever you want
    'You might want to put all entities drawn in this action into a
    collection or selectionSet
    'So when the userform showing again, yuo can allow user to undo what
    have been drawn
    'by deleting everything in the collection or selectionSet

    'Show userform back
    Me.Show

    End Sub
    4. Now that the userform is back, user can do the thing all over again.

    Put a bit imagination on the form design, you can allow user draw as many
    times as he wants and undo any unwanted stuff.

    There could be many other better ways to do it. Just give you an simple
    idea.


    to select a starting point. This subroutine then calls UserForm1 which asks
    the user to type in the X and Y dimensions of a rectangle.
    option of selecting a another starting point without having to end the
    program, and run the macros program again.
     
    Norman Yuan, Jun 7, 2004
    #2
  3. KCGalloway

    KCGalloway Guest

    Thank you Norman. That helped me out a lot.

    Best,

    Kevin
     
    KCGalloway, Jun 7, 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.