adding controls dynamically

adding controls dynamically

Anonymous
Not applicable
762 Views
7 Replies
Message 1 of 8

adding controls dynamically

Anonymous
Not applicable
I'm using acad 2002 and I'm trying to add some controls dynamically. I have
a form that has a multipage control on it. This control has pages added to
it dynamically based on the number of drawings that are open. (this part
I've got working). Where I'm having my problem is creating controls that are
needed on this new page. I'm trying to create another multipage control on
the new page which will have two pages with a listview control on each of
the subpages.

If I could see an example of how any type of control is added dynamically,
it would give me enough to figure it out.

TIA

Brent
0 Likes
763 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
You would do it the same way that you are adding tab pages, except that you
add the new controls to the page's Controls collection.

--
Ed
--

"Brent" wrote in message
news:126E3CC01C0F3E04CF9518FD10EAAA2C@in.WebX.maYIadrTaRb...
> I'm using acad 2002 and I'm trying to add some controls dynamically. I
have
> a form that has a multipage control on it. This control has pages added to
> it dynamically based on the number of drawings that are open. (this part
> I've got working). Where I'm having my problem is creating controls that
are
> needed on this new page. I'm trying to create another multipage control on
> the new page which will have two pages with a listview control on each of
> the subpages.
>
> If I could see an example of how any type of control is added dynamically,
> it would give me enough to figure it out.
>
> TIA
>
> Brent
>
>
0 Likes
Message 3 of 8

Anonymous
Not applicable
I keep getting the error "Invalid Class String" when I try to create a
control.

Dim myCtrl as Control

Set myCtrl = pgDwgX.Controls.Add("MSFORMS.textbox.1", "mytextbox",true)



"Ed Jobe" wrote in message
news:804F92752C0E2A068CE68ED8EB79E239@in.WebX.maYIadrTaRb...
> You would do it the same way that you are adding tab pages, except that
you
> add the new controls to the page's Controls collection.
>
> --
> Ed
> --
>
> "Brent" wrote in message
> news:126E3CC01C0F3E04CF9518FD10EAAA2C@in.WebX.maYIadrTaRb...
> > I'm using acad 2002 and I'm trying to add some controls dynamically. I
> have
> > a form that has a multipage control on it. This control has pages added
to
> > it dynamically based on the number of drawings that are open. (this part
> > I've got working). Where I'm having my problem is creating controls that
> are
> > needed on this new page. I'm trying to create another multipage control
on
> > the new page which will have two pages with a listview control on each
of
> > the subpages.
> >
> > If I could see an example of how any type of control is added
dynamically,
> > it would give me enough to figure it out.
> >
> > TIA
> >
> > Brent
> >
> >
>
>
0 Likes
Message 4 of 8

Anonymous
Not applicable
Try "Forms.TextBox.1".

--
Ed
--

"Brent" wrote in message
news:7C232D0585DD906B6AEE2530505A867A@in.WebX.maYIadrTaRb...
> I keep getting the error "Invalid Class String" when I try to create a
> control.
>
> Dim myCtrl as Control
>
> Set myCtrl = pgDwgX.Controls.Add("MSFORMS.textbox.1", "mytextbox",true)
>
>
>
> "Ed Jobe" wrote in message
> news:804F92752C0E2A068CE68ED8EB79E239@in.WebX.maYIadrTaRb...
> > You would do it the same way that you are adding tab pages, except that
> you
> > add the new controls to the page's Controls collection.
> >
> > --
> > Ed
> > --
> >
> > "Brent" wrote in message
> > news:126E3CC01C0F3E04CF9518FD10EAAA2C@in.WebX.maYIadrTaRb...
> > > I'm using acad 2002 and I'm trying to add some controls dynamically. I
> > have
> > > a form that has a multipage control on it. This control has pages
added
> to
> > > it dynamically based on the number of drawings that are open. (this
part
> > > I've got working). Where I'm having my problem is creating controls
that
> > are
> > > needed on this new page. I'm trying to create another multipage
control
> on
> > > the new page which will have two pages with a listview control on
each
> of
> > > the subpages.
> > >
> > > If I could see an example of how any type of control is added
> dynamically,
> > > it would give me enough to figure it out.
> > >
> > > TIA
> > >
> > > Brent
> > >
> > >
> >
> >
>
>
0 Likes
Message 5 of 8

Anonymous
Not applicable
Thanks Ed - that finally worked.

I came across the "MSForms.Textbox.1" by scouring through so much stuff. In
the future, where can I find what is the correct syntax to use in situations
like this?

"Ed Jobe" wrote in message
news:78C2E5ED736460F2143D198FA7577985@in.WebX.maYIadrTaRb...
> Try "Forms.TextBox.1".
>
> --
> Ed
> --
>
> "Brent" wrote in message
> news:7C232D0585DD906B6AEE2530505A867A@in.WebX.maYIadrTaRb...
> > I keep getting the error "Invalid Class String" when I try to create a
> > control.
> >
> > Dim myCtrl as Control
> >
> > Set myCtrl = pgDwgX.Controls.Add("MSFORMS.textbox.1", "mytextbox",true)
> >
> >
> >
> > "Ed Jobe" wrote in message
> > news:804F92752C0E2A068CE68ED8EB79E239@in.WebX.maYIadrTaRb...
> > > You would do it the same way that you are adding tab pages, except
that
> > you
> > > add the new controls to the page's Controls collection.
> > >
> > > --
> > > Ed
> > > --
> > >
> > > "Brent" wrote in message
> > > news:126E3CC01C0F3E04CF9518FD10EAAA2C@in.WebX.maYIadrTaRb...
> > > > I'm using acad 2002 and I'm trying to add some controls dynamically.
I
> > > have
> > > > a form that has a multipage control on it. This control has pages
> added
> > to
> > > > it dynamically based on the number of drawings that are open. (this
> part
> > > > I've got working). Where I'm having my problem is creating controls
> that
> > > are
> > > > needed on this new page. I'm trying to create another multipage
> control
> > on
> > > > the new page which will have two pages with a listview control on
> each
> > of
> > > > the subpages.
> > > >
> > > > If I could see an example of how any type of control is added
> > dynamically,
> > > > it would give me enough to figure it out.
> > > >
> > > > TIA
> > > >
> > > > Brent
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes
Message 6 of 8

Anonymous
Not applicable
When in vbaide, Help>Contents>Microsoft Forms Reference>Microsoft Forms
Object Model Reference>Methods>Add

--
Ed
--

"Brent" wrote in message
news:11F4513B381B384F362DA1404A3C7E7A@in.WebX.maYIadrTaRb...
> Thanks Ed - that finally worked.
>
> I came across the "MSForms.Textbox.1" by scouring through so much stuff.
In
> the future, where can I find what is the correct syntax to use in
situations
> like this?
>
> "Ed Jobe" wrote in message
> news:78C2E5ED736460F2143D198FA7577985@in.WebX.maYIadrTaRb...
> > Try "Forms.TextBox.1".
> >
> > --
> > Ed
> > --
> >
> > "Brent" wrote in message
> > news:7C232D0585DD906B6AEE2530505A867A@in.WebX.maYIadrTaRb...
> > > I keep getting the error "Invalid Class String" when I try to create a
> > > control.
> > >
> > > Dim myCtrl as Control
> > >
> > > Set myCtrl = pgDwgX.Controls.Add("MSFORMS.textbox.1",
"mytextbox",true)
> > >
> > >
> > >
> > > "Ed Jobe" wrote in message
> > > news:804F92752C0E2A068CE68ED8EB79E239@in.WebX.maYIadrTaRb...
> > > > You would do it the same way that you are adding tab pages, except
> that
> > > you
> > > > add the new controls to the page's Controls collection.
> > > >
> > > > --
> > > > Ed
> > > > --
> > > >
> > > > "Brent" wrote in message
> > > > news:126E3CC01C0F3E04CF9518FD10EAAA2C@in.WebX.maYIadrTaRb...
> > > > > I'm using acad 2002 and I'm trying to add some controls
dynamically.
> I
> > > > have
> > > > > a form that has a multipage control on it. This control has pages
> > added
> > > to
> > > > > it dynamically based on the number of drawings that are open.
(this
> > part
> > > > > I've got working). Where I'm having my problem is creating
controls
> > that
> > > > are
> > > > > needed on this new page. I'm trying to create another multipage
> > control
> > > on
> > > > > the new page which will have two pages with a listview control on
> > each
> > > of
> > > > > the subpages.
> > > > >
> > > > > If I could see an example of how any type of control is added
> > > dynamically,
> > > > > it would give me enough to figure it out.
> > > > >
> > > > > TIA
> > > > >
> > > > > Brent
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes
Message 7 of 8

Anonymous
Not applicable
Thanks for the reference information. In trying to follow the syntax, I'm
running into the same type of error when I try to
add a listview control. The control is referenced in vba and for the progid
used in the add process, I've tried
"MSComctllib.listview.1"
"comctllib.listview.1"
"comctl.listview.1" etc
and I'm still getting invalid class string - sorry to bother you again. How
does one find what progid should be used. I would have thought it would be
listed in the object browser which lists it as MSComctlLib but that doesn't
work.

TIA - brent


"Ed Jobe" wrote in message
news:B9C393F71E65EB34B9EBA0D514166796@in.WebX.maYIadrTaRb...
> When in vbaide, Help>Contents>Microsoft Forms Reference>Microsoft Forms
> Object Model Reference>Methods>Add
>
> --
> Ed
> --
>
> "Brent" wrote in message
> news:11F4513B381B384F362DA1404A3C7E7A@in.WebX.maYIadrTaRb...
> > Thanks Ed - that finally worked.
> >
> > I came across the "MSForms.Textbox.1" by scouring through so much stuff.
> In
> > the future, where can I find what is the correct syntax to use in
> situations
> > like this?
> >
> > "Ed Jobe" wrote in message
> > news:78C2E5ED736460F2143D198FA7577985@in.WebX.maYIadrTaRb...
> > > Try "Forms.TextBox.1".
> > >
> > > --
> > > Ed
> > > --
> > >
> > > "Brent" wrote in message
> > > news:7C232D0585DD906B6AEE2530505A867A@in.WebX.maYIadrTaRb...
> > > > I keep getting the error "Invalid Class String" when I try to create
a
> > > > control.
> > > >
> > > > Dim myCtrl as Control
> > > >
> > > > Set myCtrl = pgDwgX.Controls.Add("MSFORMS.textbox.1",
> "mytextbox",true)
> > > >
> > > >
> > > >
> > > > "Ed Jobe" wrote in message
> > > > news:804F92752C0E2A068CE68ED8EB79E239@in.WebX.maYIadrTaRb...
> > > > > You would do it the same way that you are adding tab pages, except
> > that
> > > > you
> > > > > add the new controls to the page's Controls collection.
> > > > >
> > > > > --
> > > > > Ed
> > > > > --
> > > > >
> > > > > "Brent" wrote in message
> > > > > news:126E3CC01C0F3E04CF9518FD10EAAA2C@in.WebX.maYIadrTaRb...
> > > > > > I'm using acad 2002 and I'm trying to add some controls
> dynamically.
> > I
> > > > > have
> > > > > > a form that has a multipage control on it. This control has
pages
> > > added
> > > > to
> > > > > > it dynamically based on the number of drawings that are open.
> (this
> > > part
> > > > > > I've got working). Where I'm having my problem is creating
> controls
> > > that
> > > > > are
> > > > > > needed on this new page. I'm trying to create another multipage
> > > control
> > > > on
> > > > > > the new page which will have two pages with a listview control
on
> > > each
> > > > of
> > > > > > the subpages.
> > > > > >
> > > > > > If I could see an example of how any type of control is added
> > > > dynamically,
> > > > > > it would give me enough to figure it out.
> > > > > >
> > > > > > TIA
> > > > > >
> > > > > > Brent
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes
Message 8 of 8

Anonymous
Not applicable
Another approach might be to create the form with as many multipage tabs as
you think you'll need, with the controls, then at runtime set the "visible"
property to false for the pages you don't need.


"Brent" wrote in message
news:126E3CC01C0F3E04CF9518FD10EAAA2C@in.WebX.maYIadrTaRb...
> I'm using acad 2002 and I'm trying to add some controls dynamically. I
have
> a form that has a multipage control on it. This control has pages added to
> it dynamically based on the number of drawings that are open. (this part
> I've got working). Where I'm having my problem is creating controls that
are
> needed on this new page. I'm trying to create another multipage control on
> the new page which will have two pages with a listview control on each of
> the subpages.
>
> If I could see an example of how any type of control is added dynamically,
> it would give me enough to figure it out.
>
> TIA
>
> Brent
>
>
0 Likes