[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 398
  • Last Modified:

Creating VB.net controls

I frequently create forms for my vb.net applications.  The forms almost always include a Clear and a Close button, which always do the same thing.  There is also a Process button and a Delete button, which always look the same, but the code attached to them would differ slightly from application to application.

I'm sure there is a way that I can put these controls into a library somewhere and just pull them from the library to a new form without having to create them each time.  But I can't figure out how to do that.  Is there a straightforward way to create and use a Controls Library for this purpose?
0
thoecherl
Asked:
thoecherl
  • 3
  • 2
2 Solutions
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
You can create a UserControl, or derive a Class from Button, to make your custom Control.  Save and compile it.

Now you can right click the ToolBox, select "Choose items", then hit Browse and navigate to the assembly containing your control.
0
 
thoecherlAuthor Commented:
Thanks Idle_Mind.  But I'm afraid I still need a bit of help.  I am not a total novice at vb.net/Visual Studio.  I have been using both for about 2 years and I have developed several projects for clients.  But there is still a lot I don't know.  I don't know how to create a UserControl nor how to derive a Class from a Button, for example.

I know it is basic stuff, but can you direct me to a link somewhere that can give me the steps I should take to do this?  Also, after I get the custom control created and, later I open Visual Studio for another project, how do I reference the control so that when I right click the tool box it will be on the list?

T
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
For a UserControl, just click on:

    Project --> Add User Control

For a Derived Button, you can do Project --> Add Class, then replace the code with something like:

    Public Class MyButton
        Inherits Button

    End Class
0
 
thoecherlAuthor Commented:
We will be testing next week, will respond then.
0
 
thoecherlAuthor Commented:
Thank you.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now