I came up with this little trick on my own but i have a feeling that its wildly inefficient
I tried saying for each MatchType1 in the tabpage.controls
but it didn't seem to understand that i would onlly want to retreive matchtyp1's and not labels or textboxes
so i set it to loop through everything but if i do that i can't access the contols methods directly i have to create a new one and then set it equal to what C is pointing at.
anyway i thought i would run this past the experts to see if there is a better way to do this
c# Code:
private void ClearRegion(string Region) { foreach (Control C in StringtoTabPage(Region).Controls) { if (C is MatchType1) { MatchType1 holder = new MatchType1(); holder = (MatchType1)C; holder.ClearInfo(); } if(C is MatchType2) { MatchType2 holder = new MatchType2(); holder = (MatchType2)C; holder.ClearInfo(); } if (C is TextBox) { TextBox holder = new TextBox(); holder = (TextBox) C; holder.Clear(); } } }




Reply With Quote