MSDN brings nothing up, so here was my attempt at a work around.
Code:Private Sub txtTime1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtTime1.Leave, txtTime2.Leave, txtTime3.Leave, _ txtTime4.Leave, txtTime5.Leave, txtTime6.Leave, txtTime7.LeaveBecause event leave calls another sub i need the last active control. I have the textbox name txtTime{0} but obviously string is not a control.Code:Dim LastActiveTimeControl As String = Me.ActiveControl.Name Dim n As Integer = CInt(LastActiveTimeControl.Substring(LastActiveTimeControl.Length - 1)) n += -1 Dim newTime As String = String.Format("txtTime{0}", n)
So Two questions:
1) can a string value be attached to an existing control if i know it's name?
Dim attControl as Control = newTime
2) All this could be avoided in event leave if i could get the left controls name. I have tried sender.tostring etc but nothing returns the textboxs name




Reply With Quote