![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | e.FindControl() Hi all, I want to loop thru the Controls.Controls collection to find a listbox located within the 3rd tabpage of a tabcontrol on my windows form. I've written this code, but I don't want to hard-code the tabpage index. I want the code to be able to search thru all the tabpages for the listbox. So far the line "tabCtl1.Controls" only captures the TabControl.ControlCollection on TabPages[n]. private void test(string mode) { foreach (Control lb_control in this.tabCtl1.Controls) { string ctrlName = String.Format("lb{0}2", mode); if (lb_control.GetType().Assembly.GetName().Name == "ListBox") { if (lb_control.Name == ctrlName) { txtDHValues.Text = ""; return; } } } } Thanks in advance. regards, Andrew |
My System Specs![]() |
![]() |
| Thread Tools | |
| |