Click to See Complete Forum and Search --> : Building Frame names using strings
nickwa
May 3rd, 2001, 07:52 PM
HI, I have 90 Frames that I want to check to see if the option box has been checked. I can make 90 if statements, ie Frame1, Frame2, ...Frame90, or use one loop as the only thing that changes is the number of the Frame, which is sequential ie 1,2,3,4,5,..90. See how much code I would save. When I build the frame name with a string & number etc... ie Frame1.value as "Frame" & number & "Value" I get an error! is there a way to do this? Visual BAsic sees it as a string, not as the name of an object etc... thanks very much
cksiow
May 3rd, 2001, 09:13 PM
you can loop through each control in a form like this
dim formctrl
for each formctrl in Form1 'assume Form1 is the form name
if typeof formctrl is Frame then
'check the option box for this frame
end if
next formctrl
HTH
cksiow
http://vblib.virtualave.net - share our codes
Cimperiali
May 4th, 2001, 05:54 AM
cksiow is right. and if you want to do different things with name of frame, you can use:
dim formctrl
for each formctrl in Form1 'assume Form1 is the form name
if typeof formctrl is Frame then 'check the option box
if formctrl.name = "Frame" & number then 'this do works: you're matching strings
end if
end if
next formctrl
Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.