Hey all.
I two subs that are almost exactly identical that return two different types of control
I would use the sub something like
textbox1.text = stringtoMatchtype1("match1").chatter;
where chatter is a property of matchtype1(and 2)
I could just return a control but then i couldnt access the propertys and methods of that contorl.
any ideas to point me down a better path?
c# Code:
private MatchType1 StringToMatchType1(string name) { foreach (TabPage tp in tabControl1.Controls) { foreach (Control c in tp.Controls) { if (c is MatchType1) { if (c.Name == name) { return (MatchType1)c; } } } } throw new Exception("Matchtype1 not found" + name); } private MatchType2 StringToMatchType2(string name) { foreach (TabPage tp in tabControl1.Controls) { foreach (Control c in tp.Controls) { if (c is MatchType2) { if (c.Name == name) { return (MatchType2)c; } } } } throw new Exception("Matchtype2 not found" + name); }




Reply With Quote