VB.NET Tutorial – Create a DLL / Class Library (Visual Basic .NET)

In this Visual Basic .NET tutorial I will be showing you how to create and use your own DLL (Dynamic Link Library) in your VB.NET projects.

We will create a DLL file for managing form graphics and use that DLL to draw images to forms and form controls.

TUTORIAL FEATURES:
DLL – Library, Namespace, Class
Graphics – System.Drawing, Image
Form Controls – Button, PictureBox
Class – Image Manager

Comments

Douglas Teachout says:

I always use Option Strict On and the line Dim G as Graphics = Surface.CreateGraphics gives a late binding error.  How can I get rid of this error (any ideas)?

Myke Ruiz says:

This is a very interesting tutorial. It helps a lot for a beginner like me. Thank you for uploading tutorials like this.

lloyd short says:

excellent presentation

graph exx says:

how or where i could find or create the comwrap.dll and toolkitpro1201vc90.dll file missing from my computer

Piyarul Islam says:

this is real

VRV Gadgets says:

Hello, how can i create Activex control in VB.net (VS2010). I just want to create simple speedometer in VB.net

walkcomp says:

Nicely done Thanks

shabeer shah says:

i loved this!!!!!!!!!!!!!, super buddy, keep uploading.

Emag says:

C# and Java got a lot of similarities :O
At least in the coding language.

YASSINE says:

thanks.. it’s very helpful :)

Sachin Malla says:

What we have to do for importing xls, csv and xlsx file
thank you

george gallimore says:

it’s not working for me, I follow your every step and all that i am getting is a BIG “X” in my form.
give me some hint,

Terry says:

Thanks 😀

HazardEdit says:

might be a stupid question, however… is it possible to export a dll from visual basic and use it in c#? since both languages are .NET?
for example i like the easy md5 function from visual basic and want to use it in c#.

Ly Watanak says:

This is the best project for me thz VB Toolbox

Iordan Chis says:

First o all great job! I hope you’re still making videos like this. You’re doing humanity a great service! Thank you sir! 😀

The Image in the PictureBox doesn’t load a second time after I’ve loaded and then deleted it once. Why is that? Shouldn’t it appear/reappear and disappear every time i click on the Draw and Delete buttons? If not, how do I make it work like that? Thanks!

Fehera85 says:

31:33 LOOOL Where is that came from? I love your tuts!! No1 on my list

Devin Dwight says:

I made a .dll file with an XNA base.  So all I would need to do is move that “.dll” file into any project that I could use those same boilerplate classes?

george gallimore says:

here’s my code: class 1
Imports System.Drawing

Namespace GDI

Public Class IMmanager
Public images As New Dictionary(Of String, Image)

Public Sub loadImage(name As String, path As String)
If images.ContainsKey(name) Then
Exit Sub
Else
Try
Dim i As Image = Image.FromFile(path)
images.Add(name, i)

Catch ex As Exception

End Try
End If
End Sub

Public Sub removeImage(name As String)
If images.ContainsKey(name) Then images.Remove(name)
End Sub

Public Sub drawImage(surface As Object, name As String, position As Point, Optional size As Point = Nothing)
Try
If images.ContainsKey(name) Then
Dim G As Graphics = surface.creategraphics
If size.IsEmpty Then
G.DrawImage(images(name), position)
Else
G.DrawImage(images(name), New Rectangle(position.X, position.Y, size.X, size.Y))

End If
End If
Catch ex As Exception

End Try
End Sub
End Class

End Namespace

for form1

Imports GFX.GDI

Public Class Form1
Private ImgMan As IMmanager

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ImgMan.loadImage(“Home”, “Home.png”)
‘ImgMan.loadImage(“deadpool”, “deadpool.png”)
End Sub

Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
ImgMan.drawImage(Me, “Home”, New Point(0, 0), New Point(Me.Width, Me.Height))
End Sub
End Class

Metiteo Pinto says:

very long and complicated tutorial for this title. Creating a dll class should be simple as just a function and how call this dll from other project.

Jekku Kepponen says:

Hey dude i needreally your help i know that you know what i mean. Im wanted to import file in the exe file (in visualbasic code language) and make injector for it so people cant copy the dll file but they can inject it to game/process. thanks a lot.

aequabit says:

Totally love you, apart from the coding stuff. Keep it up, you’re one of the rare, good guys on YouTube.

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours