Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hey!


I want to create an interface for a usercontrol in VB.net so I can use usercontrols in different .dll's in the same way.

(Like toolbars in webbrowsers so my parentprogram have to ask some things and there will be an event of the usercontrol that should be handled by the form itselve.)

So my question is:
Do I have to specify that it's a usercontrol?
If so, how do you set in your interface?


Thanks for your reply,

regards,

wimvr
Posted
Comments
Sergey Alexandrovich Kryukov 6-Jul-12 18:45pm    
What that "specification" could possibly mean?
--SA

1 solution

No, you don't have to. Why? And what "specify that it's a user control" would mean? Not that you need or need not to do it, the whole notion makes no sense. Do you understand what is the type? Inheritance? Run-time vs compile-time type? You should understand it all and a lot more to do some programming. A type is a type, there is nothing to specify.

[EDIT]

Thank you for explanation of your goals. Here is what you need to understand about the UserControl. The class System.Windows.Controls.UserControl had no essential additional functionality compared to its base class System.Windows.Controls.ContentControl and the class System.Windows.Forms.UserControl had no essential additional functionality compared to its base class System.Windows.Forms.ContainerControl. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.usercontrol.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.controls.usercontrol.aspx[^].

The main purpose of user control classes is that they can cooperate with the Designer. Now, the Designer is the tool for creation of simple ad-hoc controls quickly. If you try to do a bit more serious work with the Designer, you just waste time, because using the Designer is all manual ineffective work. So, it's hard to say if the user controls classes can make a good plug-in interface. I would rather advise to base you plug-in interfaces on the class System.Windows.Controls.Control or System.Windows.UIElement for WPF or the class System.Windows.Forms.Control, to give the plug-in developers more comprehensive palette of development capabilities where user control would be just one of the ways to develop the UI plug-ins.

—SA
 
Share this answer
 
v2
Comments
wimvr 7-Jul-12 18:52pm    
Hey!

Thank you for your reply ;-).
I know the basics of inheritance from java. Now I know what I have to know, you can not 'make' a template of a usercontrol itself (so the compiler do not know whether the interface is a usercontrol or not). (Don't know if it's right what I'm saying, normally don't speak English)

My plan is to make plugins that only contains a usercontrol (and it's functionality), so that's why those questions. Now I know how I can do it ;-)
Sergey Alexandrovich Kryukov 7-Jul-12 21:18pm    
You are welcome. Please see the update, after [EDIT].
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900