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




About this tutorial:

Video duration: 32:29
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

Post Author: OfficeTutes.com

Apple lover, ICT and LEAN consultant, MS Office lecturer My other website with video tutorials - Tutorials, guides and news for iPhones and iPads

21 thoughts on “VB.NET Tutorial – Create a DLL / Class Library (Visual Basic .NET)

    Magnum

    (October 22, 2018 - 8:17 am)

    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.

    Iordan Chis

    (October 22, 2018 - 8:17 am)

    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!

    Amos Eder

    (October 22, 2018 - 8:17 am)

    FromFile brings an exception error it does not belong to System.Drawing

    graph exx

    (October 22, 2018 - 8:17 am)

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

    VRV Gadgets

    (October 22, 2018 - 8:17 am)

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

    Myke Ruiz

    (October 22, 2018 - 8:17 am)

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

    lloyd short

    (October 22, 2018 - 8:17 am)

    excellent presentation

    aequabit

    (October 22, 2018 - 8:17 am)

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

    YASSINE

    (October 22, 2018 - 8:17 am)

    thanks.. it's very helpful 🙂

    george gallimore

    (October 22, 2018 - 8:17 am)

    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

    george gallimore

    (October 22, 2018 - 8:17 am)

    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,

    shabeer shah

    (October 22, 2018 - 8:17 am)

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

    Ly Watanak

    (October 22, 2018 - 8:17 am)

    This is the best project for me thz VB Toolbox

    HazardEdit

    (October 22, 2018 - 8:17 am)

    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#.

    Terry

    (October 22, 2018 - 8:17 am)

    Thanks 😀

    Emag

    (October 22, 2018 - 8:17 am)

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

    Douglas Teachout

    (October 22, 2018 - 8:17 am)

    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)?

    Piyarul Islam

    (October 22, 2018 - 8:17 am)

    this is real

    Fehera85

    (October 22, 2018 - 8:17 am)

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

    Sachin Malla

    (October 22, 2018 - 8:17 am)

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

    Devin Dwight

    (October 22, 2018 - 8:17 am)

    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?

Leave a Reply

Your email address will not be published. Required fields are marked *