Click here to Skip to main content
15,885,036 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,
i have a form in which clicking on a "NEW PAGE" button opens a new TabPage. This happens at runtime. So how do i know which tabPage is currently active so that i can retrieve the values of that particular tabPage and display it in a TextBox .
Can anyone please help.!!!
Thanks:)
Posted

you can use TabControl.SelectedTab Property[^]
for example if you have RichTextBox with name "rtb" in your selected tab, you can check and get the control as below
C#
if (tabControl1.SelectedTab.Controls.ContainsKey("rtb"))
{
  RichTextBox selectedRtb = (RichTextBox)tabControl1.SelectedTab.Controls["rtb"];
}
 
Share this answer
 
v5
Comments
sovit agarwal 5-Jun-14 2:45am    
That is excellent but how do i select say a row value of a datagridview ?
Sergey Alexandrovich Kryukov 5-Jun-14 3:18am    
Accept this answer, to start with. This is unrelated question. But don't ask it just yet. First, read MSDN documentation on the topic. This is not a documentation finder service for the lazy.
—SA
Sergey Alexandrovich Kryukov 5-Jun-14 3:19am    
5ed. Oh, it takes patience... :-)
—SA
DamithSL 5-Jun-14 3:43am    
Thank You SA
Use
TabControl.SelectedTab Property
to get which is current selected tab
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900