Create a new project using the Class Library template and give it the name “TestClass”.

Save your project to your favorite directory. From Windows
Explorer, locate your project directory and copy in the bitmap you want to use
as your Toolbox Bitmap. Important:
Rename the bitmap to the name of your class. In our case the new project created
Class1.vb, so our image name must be Class1.bmp.

Return to Visual Basic and add references to System.Drawing and System.Windows.Forms.

From the Solution Explorer add an existing item and select the bitmap image you pasted in the project directory. You will need to change the “Objects of file type:” drop down to “All Files(*.*) “ so you can select the image.

Once you have added your image file the Solution Explorer should look like this.

Select Class1.bmp in the Solution Explorer. In the Properties window, change Build Action to Embedded Resource.

Open Class1.vb and add Imports System.Drawing and Imports System.Windows.Forms
Add the ToolboxBitmap attribute to your class. Your code should be as follows.
Imports System.Drawing
Imports System.Windows.Forms
<ToolboxBitmap("Class1.bmp")>
_
Public Class
Class1
Inherits Button
End Class
Build your solution.

When you build you solution, your new dll will be located in .. TestClass\TestClass\bin\Release
Open the Toolbox in the IDE and right click in the toolbox, select “Choose Items”.

When presented with the Choose Toolbox Items dialog, use the Browse button to locate your newly created dll file. Once you have selected it, Class1 will show up under the .Net Frameworks Components tab. Click on Class1 in the list. In the description box at the bottom of the dialog you should see your image.

You may find that you have designed your component inside of its own namespace. In this case, you must fully qualify the name of the image that you want to use as its icon.
Imports System.Drawing
Imports System.Windows.Forms
Namespace Foo
<ToolboxBitmap("Foo.Class2.bmp")> _
Public Class Class2
Inherits Button
End Class
End Namespace
You will notice in this code sample that the image name is Foo.Class2.bmp.
Because Class2 resides in namespace Foo you have to use the full name.

For your ToolboxBitmap to work: