Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 20th, 2007, 04:53 AM
Registered User
 
Join Date: Dec 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default TabControl - many tabs, one TabPage

How do I create a TabControl having a number of tabs, but a single TabSheet? I want to change the contents of the single TabPage according to the selected tab.



 
Old December 20th, 2007, 05:16 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

That's not really the way the TabControl works, as I suspect you have found.

If you really want to do this then your best bet might be to simply have a groupbox with a selection of toggle buttons in, rather than trying to use the TabControl.

/- Sam Judson : Wrox Technical Editor -/
 
Old December 20th, 2007, 12:02 PM
Registered User
 
Join Date: Dec 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Sam. I am new to Visual C# from Borland C++ Builder. I was looking for something similar to the Builder TTabControl which is convenient for displaying a variety of datasets in using a single datagrid, the contents of which is changed according to the selected tab. The tab format makes it suitable for dynamic configuration (i.e. adding or removing tabs).


Quote:
quote:Originally posted by samjudson
 That's not really the way the TabControl works, as I suspect you have found.

If you really want to do this then your best bet might be to simply have a groupbox with a selection of toggle buttons in, rather than trying to use the TabControl.

/- Sam Judson : Wrox Technical Editor -/
 
Old December 20th, 2007, 12:42 PM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

The equivalent to the .Net TabControl in Borland is the TPageControl I believe.

/- Sam Judson : Wrox Technical Editor -/
 
Old December 22nd, 2007, 08:46 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

There's nothing to stop you from replicating that behavior with a tab control, but it will involve dropping separate datagrids onto each tab. You'll be using multiple controls to mimic the effect of having one control that displays different behavior depending on the tab selected.

As Sam said, the more functional way to solve the problem in .NET is to use a different control to manipulate the datagrid results, typically a form component. That's the more elegant solution in .NET unless you really like using the tab interface, in which case, yes, you're sort of trying to horseshoe that functionality into your application. Or you could try doing some custom component building. :D I think it's fun, but then I'm a geek so what do you expect.

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
disable tabpage in windows application? Hannibal C# 2005 5 February 7th, 2007 12:44 PM
Tabpage in runtime g0dchild_85 C# 3 August 9th, 2006 09:29 AM
need help on tabcontrol Haydeé VB.NET 2002/2003 Basics 1 May 23rd, 2006 04:31 AM
Add a tabpage to a tabcontrol Mosquito109 VS.NET 2002/2003 0 August 18th, 2004 08:35 PM
Disabling Tabpage rajustha VB How-To 0 December 9th, 2003 10:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.