Hi
yeah u sure can do that. I have shown 2 methods. The first one is your situation where each textbox is named differentlyeg Text1, Text2, Text3 etc .The second one shows how much easier it is if u use a control array eg Text1(0), Text1(1), Text1(2) etc... A control array is just the same control copied over and over with a new Index property each time.
VB Code:
Dim TheActiveControl As Control
Private Sub Command1_Click()
TheActiveControl.Text = ""
End Sub
Private Sub Text1_GotFocus()
Set TheActiveControl = Text1
End Sub
Private Sub Text2_GotFocus()
Set TheActiveControl = Text2
End Sub
Private Sub Text3_GotFocus()
Set TheActiveControl = Text3
End Sub
Private Sub Text4_GotFocus()
Set TheActiveControl = Text4
End Sub
Private Sub Text5_GotFocus()
Set TheActiveControl = Text5
End Sub
VB Code:
Dim ActiveBox As Integer
Private Sub Command1_Click()
Text1(ActiveBox).Text = ""
End Sub
Private Sub Text1_GotFocus(Index As Integer)
ActiveBox = Index
End Sub
Regards
Stuart