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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Name Manipultation!

Status
Not open for further replies.

Quijian

ISP
Jul 9, 2004
32
US
Hey guys, I am having problem with manipulating a object name. Here is the case:

xpic as string
picbox as string

I have multiple image boxes named picbox_1, picbox_2, picbox_3, ect. What I want to do is that xpic contain a number and picbox contain "picbox_" and I want to add xpic and picbox together as a object name. Like this:

picbox + xpic.visibility = false

I will take any suggestions, thanks!
 

dim a as string
dim b as string
dim c as string

a = "Picbox"
b = "1"
c = a & b

(SUB)

Select case c

Case "Picbox1"

Picbox1.visible = true

Case "Picbox2"

Picbox2.visible = true

End Select

(End Sub)

Change a and b as you wish and call the sub

Ortho
 
Hi Quijian
Why not have your picboxes as an array? Then you can refer to it using xpic as the index.

picbox(xpic).visible = false

[bigcheeks]
 
or you could do

Me.Control("picbox" & xpic).visible = False
 
that should be

Me.Controls(picbox & xpic).visible=false

for teh "s" in controls
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top