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.
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
Quote:
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 -
Quote:
Private Sub CommandButton1_Click()
Unload Me
End Sub