Consider the following code;

Private Sub Label1_Click()
If InStr(1, Selection, "!") Then
Label1.Caption = "Found a !"
Label1.Caption = "Didn't find a !"
End If
End Sub

What is the significance and meaning of the underscore in the 1st line Are there other options for the name of this Sub such as Label1_xyz() that would make the Sub act in diferent ways Does this mean Click() is a function of some sort that can be applied to the Label1 Sub

I notice the Caption property of the Label1 object is accessed using the . character as a separator. Why is it not then Label1.Click()

This probably is a bit nonsensical but an answer will really help me get my head around VB code.

PS Sorry about the weird indenting in this post, this text editor is doing strange things that I cannot control.

Re: Naming Subs


No there are two type of procedure one in Function and another is Subrotin.Sub means sub rootin means which does not return value.And label1_click() means what happen if some one click on this Label name label1.If you use dblclick that meand double click in that way.and underscore is a seperator between object name and event name.(Here Click is a event)