VB.Net Form DirectCast on Forms.Panel -


i need loop through textboxes of form, located inside panel. i'm trying this....

for each cntrl control in directcast(me.controls(panelname), panel).controls  next 

the reason need feed panel's name loop because have 2 panels exist in 2 different tabpages. button exists on each tabpage performs same function, panels , textboxes have different names. have loop inside function handles both tabpage button clicks, therefore need loop point right panel.

the "panelname" matches target panel's name, , panel of system.windows.form.panel.

i "object reference not set instance of object." message.

is not possible?

no need cast:

for each cntrl control in panelname.controls  next 

if have name of panel , not control reference, @ least need know tabpage has panel:

for each ctrl control in tabcontrol1.tabpages(1).controls("panel1").controls  next 

alternatively, can use:

me.controls.find(panelname, true) 

to return panel name while searching child controls recursively.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -