When we click “Display”, welcome to VB will appear.
“Clear” will clear the text box and “Close” will quit the application.
B) Property :
Textbox : NAME – text1 , Text-(should kept blank) Command Button 1 : NAME - Command1, CAPTION-Display Command Button 2 : NAME - Command2, CAPTION-Clear Command Button 3 : NAME - Command3, CAPTION-Close |
C) Attaching Code to the Object :
Private Sub Command1_Click() Text1.Text = "Welcome to VB" End Sub |
Private Sub Command2_Click() Text1.Text = " " End Sub |
Private Sub Command3_Click() Beep End End Sub |
Tip :
There is a property called ToolTipText . If we write something here, we can see that as a caption while running the program.
Example : Add the ToolTipText property for each command button for the above program,as given below :
Property :
Command Button 1 : NAME - Command1, CAPTION-Display,ToolTipText : Display Command Button 2 : NAME - Command2, CAPTION-Clear, Command Button 3 : NAME - Command3, CAPTION-Close,ToolTipText : Close |
While running the program , if we place the cursor near the first command button , we can see a caption as Display , and Clear , Close etc can see as captions , while placing the mouse near Command Button 2, Command Button 3 respectively.
=======================
Back to Home & VB
=========================================================================
No comments:
Post a Comment