TIP: Click on subject to list as thread! ANSI
echo: visual_basic
to: All
from: John
date: 2004-02-25 15:33:00
subject: Re: How to Pass Object in

> 
> You could create a "global" object variable and Set it in
the GotFocus event
> of each TextBox. Then that variable will hold a reference to the last
> TextBox the user Clicked in. Something like this
> 
>     Dim CurrentTextBox As TextBox
> 
>     Private Sub txtAddress_GotFocus()
>       Set CurrentTextBox = txtAddress
>     End Sub
> 
>     Private Sub txtCity_GotFocus()
>       Set CurrentTextBox = txtCity
>     End Sub
> 
>     Private Sub txtApproverName_GotFocus()
>       Set CurrentTextBox = txtApproverName
>     End Sub
> 
>     Function WhatIsCurrentTextBoxName() As String
>       WhatIsCurrentTextBoxName = CurrentTextBox.Name
>     End Function
> 
>     Private Sub Command1_Click()
>       Debug.Print WhatIsCurrentTextBoxName
>     End Sub
> 
> Of course, the above assumes the function is executed from the form the
> CurrentTextBox is declared on. If the function resides on a different form
> or in a BAS Module, you will have to declare it in a BAS Module to make it
> project-wide global. Also, the above assumes the function won't be kicked
> off where other TextBoxes could have the focus. If so, you will have to
> clear the reference in those other TextBoxes's GotFocus events to prevent a
> mis-identification of the TextBox.
> 
> Rick - MVP


Rick,

This works perfectly.

thanks again for your help.

John
---
þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com

---
 * RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS
 * RgateImp.MoonDog.BBS at 2/25/04 3:33:57 PM
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)
SEEN-BY: 633/267 270
@PATH: 278/230 10/345 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.