Wrox Programmer Forums
|
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 June 16th, 2007, 04:19 AM
Registered User
 
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default tab control

Hi all


I'm working with 2 forms in C#.NET 2.0. In the 1st form, I've taken a string variable in which I'm storing some value. In the 2nd form I have a tab control with 2 tab pages. By defaut, when the 2nd form is loaded and becomes visible, the 1st tab page is activated. What I want is that if the string variable of the 1st form contains some(any) value, the 3rd/last tab page of the tab control should be activated as the 2nd form is loaded.

Please help!


Amey

 
Old June 19th, 2007, 04:10 AM
Authorized User
 
Join Date: Jun 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear amey.agnihotri

TabControl has a property named SelectedIndex. You can set this property to index of any tab that you want (base on value of your string variable). You could do this just before showing second form on screen.

Form2 f2 = new Form2();
f2.tabControl1.SelectedIndex = strVariable == "OK" ? 1 : 0;





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable a tab on a tab control. dbradley VB.NET 6 April 14th, 2011 10:04 AM
Calendar Control with Tab Control Slicemahn Access 1 June 12th, 2006 10:35 PM
Tab Control Louisa VB.NET 2002/2003 Basics 4 September 26th, 2005 09:43 AM
Tab control Bhanu VS.NET 2002/2003 2 March 6th, 2005 04:12 AM
Tab Control Bhanu .NET Framework 2.0 1 December 2nd, 2004 07:25 AM





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