Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop through 3 textboxes to see which one is visible

Status
Not open for further replies.

aarondewberry

IS-IT--Management
Jul 20, 2005
148
GB
All

This is gonna be an easy one for you guys.

Background
I have 3 textboxes: txtPOV, txtPO, txtPU.
Only one of these textboxes will be visible at any one time.

Problem
I want to be able to click a button, then a msgbox will pop up, showing which textbox is visible at that time.

This one has me stumped on a friday!!
 
There are loads of ways to do this.

One (rather lazy) way to do this is to set the .Tag property of the textbox to it's name when it's visible (and to "" when it's not), then in your Click event just do
Code:
MsgBox txtPOV.Tag & txtPO.Tag & txtPU.Tag
Hope this helps

HarleyQuinn
---------------------------------
Black coat, white shoes, black hat, cadillac. The boy's a timebomb!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before post
 
How are ya aarondewberry . . .

Perhaps this will do:
Code:
[blue]   Dim IsVis As String
   
   If Me!txtPOV.Visible Then IsVis = "txtPOV"
   If Me!txtPO.Visible Then IsVis = "txtPO"
   If Me!txtPU.Visible Then IsVis = "txtPU"
   
   MsgBox "'" & IsVis & "' Is Visible!"[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Two different, simple ways.

Thanks guys!

I feel its time to go home already!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top