Hi,
I don't know whether this is optimize solution or not but u can Have a Enum which will keep the Track of Last Focused TextBox.
e.g
Public Enum tbFOcus
tb1 = 1
tb2 = 2
tb3 = 3
End Enum
Private pi_enumFocus As tbFOcus
Set the Value of pi_enumFocus in TextBox's Enter Event as
Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter
pi_enumFocus = tbFOcus.tb1
End Sub
and in Button's Click event u can get
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("Last Focus was on " & pi_enumFocus)
End Sub
I hope this will help u............
Regards,
Ritesh
--
Message posted via
http://www.dotnetmonster.com