I created a bunch of usercontrol that I need to pass to a generic procedure that will copy and place them on a form.
something like this:
dosomething(usrCtl1)
dosomething(usrCtl2)
dosomething(usrCtl3)
I tried this code but did not work.
private sub dosomething(uc as UserControl)
for i as integer = 0 to 3
Dim myUC as UserControl
if TypeOf uc Is usrCtl1 then
myUC = Trycast(uc, usrCtl1)
elseif TypeOf uc Is usrCtl2 then
myUC = Trycast(uc, usrCtl2)
elseif TypeOf uc Is usrCtl3 then
myUC = Trycast(uc, usrCtl3)
else
myUC = Trycast(uc, usrCtl4)
end if
myUC.name = uc.name & i.tostring
......
next
Been reading thru deep and shallow copy, but quite not there yet, being a .net newbie.
Any help will be greatly appreciated.
something like this:
dosomething(usrCtl1)
dosomething(usrCtl2)
dosomething(usrCtl3)
I tried this code but did not work.
private sub dosomething(uc as UserControl)
for i as integer = 0 to 3
Dim myUC as UserControl
if TypeOf uc Is usrCtl1 then
myUC = Trycast(uc, usrCtl1)
elseif TypeOf uc Is usrCtl2 then
myUC = Trycast(uc, usrCtl2)
elseif TypeOf uc Is usrCtl3 then
myUC = Trycast(uc, usrCtl3)
else
myUC = Trycast(uc, usrCtl4)
end if
myUC.name = uc.name & i.tostring
......
next
Been reading thru deep and shallow copy, but quite not there yet, being a .net newbie.
Any help will be greatly appreciated.