Thursday, 15 August 2013

vb.net - Unable to dynamically load a control into a SplitContainer panel -



vb.net - Unable to dynamically load a control into a SplitContainer panel -

i have placed splitcontainer command onto form. have custom command within panel 1. custom command container user-control.

there treeview command within user-control. trying load user-control onto panel 2 upon selection of node in tree view. not getting loaded. missing something?

the code loading command given below:

dim ucimportexcel1 new ucimportexcel() frmmain.splitcontainer1.panel2.controls.add(ucimportexcel1) ucimportexcel1.dock = dockstyle.fill

an add-on above: in same treeview selection event

for code below sets form text:

me.parentform.text = "sample text 1"

whereas if utilize code, nil happens:

frmmain.text = "sample text 2"

when referred directcast, solved problem:

directcast(me.parentform.controls.item("splitcontainer1"), system.windows.forms.splitcontainer).panel2.controls.add(ucimportexcel1)

vb.net winforms custom-controls

No comments:

Post a Comment