command

i have a command box but i do not know how to set the command to do an action when u click it.
How do u?
mikejh6Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
GETTYDConnect With a Mentor Commented:
In the programming Environment:

1. create a form (Form1)
2. add a command button (Command1)
3. double-click on Command1
    the following code window will appear:
     
         Private Sub Command1_Click()

         End Sub

4. Add a line of code between the two code lines so the whole sub-routine looks as follows:

         Private Sub Command1_Click()

           MsgBox "Hello World", vbOKOnly

         End Sub


5. press the "F5" key

6. click on the Command1 button

7. a message box should appear

0
 
mcixCommented:
If you double click the command button, it will open the Form Code Module and place you within the click event.  

You could write some code to bring up a Message Box, like this
Sub Command1_Click()

   MsgBox "Hello World!",VbInformation,"The world's oldest and most over-used demo"

End Sub



0
 
FoyalCommented:
please...
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
InteqamCommented:
is mcix comment is exactly what you want?

0
 
cjwikCommented:
man, I dont' want to rude, but it is impossible to answer a question like this. You have to let us know a little bit more...
0
 
carlosvsCommented:
Imposible.. for me sorry....!
0
 
rondeaujCommented:
VB is an events driven lan. You would put your code in the event you want to fire up. Mcix shows you a prefect example for responding to the click event. You could put code in the mouseover event if you want something to happen when the user moves his/her mouse over the control.
0
All Courses

From novice to tech pro — start learning today.