Command Button in Visual Basic6.0

command button control is used to get the user’s response depending on which some specific action can taken.Command buttons determine when the user wants to do something such as exit the application or begin printing. In almost every case, you will perform these tasks to add a command button to an applicationFor example you can see the “OK” button when you click on “OK” button an event is fire and a msg box is open.


1.Open Visual Basic 6.0 and create a new Standard EXE Project.

2.From Standard EXE project Dialogbox choose Standard EXE form.

3. Add Two  Command Button  from toolbox on the form.

4.From the properties window change the caption of the Command Buttons








5.After design the form open the code window and write code:







6.Then press f5 key for output

7. when you click Command Button1 whose caption is “hello”  then  a msgbox show

like below:











Comments are closed.