 |
| View previous topic :: View next topic |
| Author |
Message |
jeaniedave Newbie
Joined: 23 Oct 2003 Posts: 2
|
Posted: Oct 23rd, 2003 12:18 AM Post subject: ActiveControl.Name |
|
|
I am entering data in a Textbox, and then using the tab to change focus to a second Textbox. Both textboxes are defined in a Handles statement on a Textbox_Validating event.
Private Sub TextBox_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating, TextBox2.Validating
'ActiveControl.Name has TextBox2 when
' tabbing from Textbox1 to Textbox2
End Sub
I wanted to use a generic routine for simplicity. But in the validating event, I see that the ActiveControl.Name is the name of the second textbox, not the first textbox that I expected since it is the value in the first textbox that I am trying to validate.
Further testing shows that the Enter and GotFocus events maintain the ActiveControl.Name value of the first textbox. But
the Leave, Validating, Validated, and LostFocus events change
and have the value of the second textbox.
Is there some other generic way to tell in the Validating event which control is being validated?
Thanks,
Dave |
|
| Back to top |
|
P.T.A.M. Administrator

Joined: 08 Oct 2003 Posts: 752 Location: Greece
|
Posted: Oct 23rd, 2003 05:19 PM Post subject: |
|
|
Is this in .Net? _________________ No one is completely useless. They can at least be an example of what to avoid. |
|
| Back to top |
|
jeaniedave Newbie
Joined: 23 Oct 2003 Posts: 2
|
Posted: Oct 23rd, 2003 09:24 PM Post subject: |
|
|
Yes it is.
And I found the technique. I have to cast the sender object to a textbox.
Dim t as TextBox
t = Ctype(sender,Textbox)
now, t.name contains the name of the control passed. |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|