Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / July 2007

Tip: Looking for answers? Try searching our database.

Controls Added To TabPages In Designer - How Do You Access?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gary Brown - 30 Jul 2007 17:20 GMT
Hi,

How do you access controls that were added to a TabPage
in Designer?  MS's documentation doesn't use Designer.
The example in TabControl defines them in the main form then
copies a reference to the TabControl's Controls property.
Walking though Controls looking for the control you want is
clumsy.  Is there a better solution?

Thanks,
Gary
Peter Duniho - 30 Jul 2007 17:54 GMT
> Hi,
>
[quoted text clipped - 4 lines]
> Walking though Controls looking for the control you want is
> clumsy.  Is there a better solution?

Better than what?  As you've already noted, the actual control is
contained as a member field in the main form's class.  You can access
the control directly via that member field, just like any other control
that is in the main form.

Pete
Gary Brown - 30 Jul 2007 18:47 GMT
>> How do you access controls that were added to a TabPage
>> in Designer?  MS's documentation doesn't use Designer.
[quoted text clipped - 3 lines]
> control directly via that member field, just like any other control that
> is in the main form.

Thanks.  I hadn't considered that Designer does exactly what the
example did - adds the controls to the main form.  But that creates
another problem because I need multiple instances of the same
page.

What I really need is tabbed MDI so I'm off in that direction.

Gary
Peter Duniho - 30 Jul 2007 18:50 GMT
> Thanks.  I hadn't considered that Designer does exactly what the
> example did - adds the controls to the main form.  But that creates
> another problem because I need multiple instances of the same
> page.
>
> What I really need is tabbed MDI so I'm off in that direction.

How about making a custom control that derives from the TabPage class?
Your control would contain the controls as members within that class,
and could be accessed that way, as class instance members.

Tabbed MDI would probably work too.  I guess it just depends on what
context you intend to use the controls/forms.  If they are more like
documents or forms, I'd go with MDI, if they are more like tabs within a
form, I'd try to stick with the TabPage paradigm.

Pete

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.