question

nachoshaw-9496 avatar image
0 Votes"
nachoshaw-9496 asked XingyuZhao-MSFT commented

Reference dll as usercontrol

Hey

Looking for a bit of advice / guidance. My current project has many usercontrols I am using as subforms that I load into a main panel on my main form. I'd like to separate them so that I have the main form application and a collection of sub projects that I can reference the compiled dll for each user control.

My idea is that whichever dll I need a can create an instance of that and add it to the panel.

So, as a separate project, how would I create it so that it returns the user usercontrol as a usercontrol? Something like this?

Imports MyUC1

Sub Test()
Dim UC1 As UserControl = New MyUC1.UC
MyPanel.Controls.Add(UC1)
End Sub

I'd like to if I need to return as the usercontrol or simply reference the usercontrol inside the dll


Thanks

dotnet-standard
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @nachoshaw-9496 ,
After adding dlls in the project and rebuild the project, could you see your custom user controls in TooBox?
For example:
84726-1.png
If so, you can drag the control directly on the form.
84754-2.png


0 Votes 0 ·
1.png (73.5 KiB)
2.png (19.9 KiB)

0 Answers