Home > Archive > Visual Basic Syntax > November 2005 > accessing controls within a frame
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
accessing controls within a frame
|
|
| Adrian 2005-11-17, 7:58 am |
| I have an array of frames[named arrFrames() ] and i create some frames
at runtime. I also put other controls[ like , text boxes, labels,
buttons etc.] within each of the frames. Now the problem is that I want
to access the controls within a frames, I don't know how to do that.
I tried - arrframes(3).lblPressureValue.caption = "10"
this doesn't work. Please help
thanks in advance.
| |
|
| Although the frames are the parents for the controls, you access them
directly, ie:
lblPressureValue.caption = "10"
"Adrian" <richard.the.lionheart@gmail.com> wrote in message
news:1132225362.407890.203820@f14g2000cwb.googlegroups.com...
>I have an array of frames[named arrFrames() ] and i create some frames
> at runtime. I also put other controls[ like , text boxes, labels,
> buttons etc.] within each of the frames. Now the problem is that I want
> to access the controls within a frames, I don't know how to do that.
>
> I tried - arrframes(3).lblPressureValue.caption = "10"
>
> this doesn't work. Please help
>
> thanks in advance.
>
| |
| Adrian 2005-11-17, 7:58 am |
| I am sorry for not making things clear enough,
actually I have 'arrFrames()' each containing a 'lblPressureValue' and
at a time in the running of the program I only know the index of the
frame within arrframes(). I want to access the 'lblPressureValue' that
is contained within the frame whose index I know.
e.g.
dim index as integer
index = fromSomeFunction
now I want to access lblPressureValue which is within arrframes(index)
hope its clear enough.
| |
| mike williams 2005-11-17, 7:58 am |
| "Adrian" <richard.the.lionheart@gmail.com> wrote in message
news:1132227664.122788.6440@g47g2000cwa.googlegroups.com...
> actually I have 'arrFrames()' each containing a 'lblPressureValue'
> and at a time in the running of the program I only know the index
> of the frame within arrframes(). I want to access the 'lblPressureValue'
> that is contained within the frame whose index I know.
Is this VB6? If so then you can't have two Label controls with the same
name, unless those Label controls are themselves part of an array of Label
controls, in which case you need to refer to them by their Index property as
well as their name.
Mike
| |
| Jan Hyde 2005-11-17, 7:58 am |
| "Adrian" <richard.the.lionheart@gmail.com>'s wild thoughts
were released on 17 Nov 2005 03:41:04 -0800 bearing the
following fruit:
>I am sorry for not making things clear enough,
>actually I have 'arrFrames()' each containing a 'lblPressureValue' and
>at a time in the running of the program I only know the index of the
>frame within arrframes(). I want to access the 'lblPressureValue' that
>is contained within the frame whose index I know.
>
>e.g.
>
>dim index as integer
>index = fromSomeFunction
>
>now I want to access lblPressureValue which is within arrframes(index)
lblPressureValue(index)
Jan Hyde (VB MVP)
--
Sex is like math. Add the bed, Subtract the clothes, Divide the legs, and Multiply! (Rodney Lee)
[Abolish the TV Licence - http://www.tvlicensing.biz/]
| |
| Jeff Johnson [MVP: VB] 2005-11-17, 7:04 pm |
|
"Adrian" <richard.the.lionheart@gmail.com> wrote in message
news:1132225362.407890.203820@f14g2000cwb.googlegroups.com...
>I have an array of frames[named arrFrames() ] and i create some frames
> at runtime. I also put other controls[ like , text boxes, labels,
> buttons etc.] within each of the frames. Now the problem is that I want
> to access the controls within a frames, I don't know how to do that.
>
> I tried - arrframes(3).lblPressureValue.caption = "10"
>
> this doesn't work. Please help
The frame control does not expose a collection of the controls it contains.
Nothing in VB does other than forms and user controls. If you create a class
and add a collection to it then you could manage this yourself, but it's not
built-in to the frame.
If what you're actually saying is that you simply want to determine what
controls are contained within a frame then the only out-of-the-box way to do
this is to loop through every control on the form and check its Container
property to see if it Is your frame.
| |
| Ken Halter 2005-11-17, 7:04 pm |
| "Jan Hyde" <StellaDrinker@REMOVE.ME.uboot.com> wrote in message
news:75von1pveb83gfcq8jj1fn95e74d9gpm9q@
4ax.com...
> Jan Hyde (VB MVP)
>
> --
> Sex is like math. Add the bed, Subtract the clothes, Divide the legs, and
> Multiply! (Rodney Lee)
Groannnnnnn <g>
> [Abolish the TV Licence - http://www.tvlicensing.biz/]
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..
| |
| Adrian 2005-11-18, 3:58 am |
| Hi,
As you suggested that, the for the frame control does not expose a
collection of the controls that are contained within it and if I want
to manage it myself then I must create a class and add acollection to
it. How exactly can I do that, could you please elaborate. Your help is
highly appriciated.
Thanks.
|
|
|
|
|