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

Top 5 Contributors of the Month

Home >> Forum >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

Finding control name inside tabpages

Posted By: subash     Posted Date: June 23, 2009    Points:2   Category :Windows Application
I have a form which contains one tabcontrol contains 7 tab pages.I want to find the controls(Label,TxtBox,Cmbo,Btn)inside the form.But when finding it shows only tabpages.I want to get control name inside tabpages,How it is possible.
Sample code i have written is
foreach (Control ctrl in Page.Controls)
if (ctrl is TextBox)
if (ctrl.Name.StartsWith("txtAl"))
//My code is here
simply i want to get the controls inside tabpages without declaring Tabpages becaues i want to dind that dynamically in each and evary form
Please help me with the code..

Author: Praveen             
Posted Date: June 24, 2009     Points: 5   

Instead Page.Controls you can do like this

Panel1.Controls (Panel1 is inside Tab1)

Happy Coding!!!

Author: Akhil Raj       [Moderator]      
Posted Date: June 24, 2009     Points: 5   

hi friend when you iterate through the page is shows from the page control only. For this each control you want to check if any child control are available. If yes iterate thought that control also like recursive model...

Author: Jaganathan             
Posted Date: July 07, 2010     Points: 5   

Hi Friends It Will Work

For Each ctr As Control In tabcontrolname.Controls
For Each ctr1 As Control In ctr.Controls
If TypeOf ctr1 Is TextBox Then
ctr1.Text = ""
End If

If TypeOf ctr1 Is ComboBox Then
ctr1.Text = ""
End If

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

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