Results 1 to 2 of 2

Thread: How to code the grand children?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2009
    Posts
    15

    How to code the grand children?

    Suppose I create a Form in Run time say Form1, and add a control say cmd1. If the user clicks the cmd1 then we have to close the Form but how to attach code to that control, exactly an event procedure for that cmd1. I want to understand the fundamentals. Thanks in advance.

  2. #2
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,657

    Re: How to code the grand children?

    Double click on the control, this will bring up your code window. It will look something like this

    Private Sub CommandButton1_Click()

    End Sub
    This is your control sub procedure for the click event, any code you write in there will execute when you click your command button.

    So now to close you form you have 2 options

    Unload Me & Me.Hide

    Unload Me completely unloads the form, Me.Hide as the name suggests only hides the form allowing you to quickly make it visible again be using Me.Show.

    Add them in you event handler -

    Private Sub CommandButton1_Click()

    Unload Me

    End Sub
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width