.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

TAB CONTROL

Posted By: vasanth     Posted Date: July 25, 2012    Points:5   Category :C#
I have a Tab control in my project.

I have three tabs in that Tab Control named (First_Tab, Second_Tab, Third_Tab). In that same form i have three Buttons named (First_Button, Second_Button, Third_Button).

I need, When i click the First_Button, ---> From the Tab Control, First_Tab will Enable and others looks Disable format user can't do any change in other tabs (2,3 tabs) except First_Tab.

When i click the Second_Button, ---> From the Tab Control, Second_Tab will Enable and others looks Disable format user can't do any change in other tabs (1,3 tabs) except Second_Tab.


When i click the Third_Button, ---> From the Tab Control, Third will Enable and others looks Disable format user can't do any change in other tabs (1,2 tabs) except Third_Tab.


Please give some ideas.........


Responses
Author: Syed Shakeer Hussain             
Posted Date: July 26, 2012     Points: 20   

Hi,

TabControl you created is in winforms or asp.net

Author: vasanth             
Posted Date: July 26, 2012     Points: 20   

Windows Forms using C#

Author: Narayanan             
Posted Date: July 26, 2012     Points: 20   

Hi Vasanth,
I think, you can remove a Tab Page. But you can't disable a Tab. But you can disable a Controls in the Tab.
try this ..
   public static void DisableTab(TabPage page, bool disable)
{
DisableControls(page.Controls, disable);
}


  private static void DisableControls(Control.ControlCollection ctls, bool disable)
{
foreach (Control ctl in ctls)
{
ctl.Enabled = disable;
DisableControls(ctl.Controls, disable);
}
}



 private void button1_Click(object sender, EventArgs e)
{
DisableTab(tabControl1.TabPages[2], false);
DisableTab(tabControl1.TabPages[3], false);


}


Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend