Windows Phone Developers

Thursday, September 15, 2011

VB.NET FindControl in Windows forms application

How to loop through windows form controls by name (C# / VB.NET)

ASP.NET dev have the advantage of FindControl, which does this work quite easily. For Windows forms developers the need to loop through the controls using ForEach in the control collection or can use the Find method as shown below:

foreach (Control ctl in Controls.Find("textBox" + i, false))

{

string stext = ctl.Text ;

};


Here we have used ControlCollection Controls.Find method to refer a Textbox and get the value Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment