Adblock breaks this site

Ceating dlls

Discussion in 'Programming General' started by X Zero, Apr 14, 2007.

  1. X Zero

    X Zero Forum Addict

    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0
    Ceating dlls

    ok, someone said i need vS 2005 to create dlls.

    i got a copy, all i need is the know how.

    can anyone help me out?

    edit: I can spell create
     
  2. speljohan

    speljohan Guru
    Visual Basic Programmers

    Joined:
    Apr 24, 2005
    Posts:
    1,450
    Referrals:
    3
    Sythe Gold:
    0
    Ceating dlls

    create a class library. Write all code in there, and when you want to call it from another application, just add your DLL on references.
     
  3. X Zero

    X Zero Forum Addict

    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0
    Ceating dlls

    yep, got it

    is it possible to do something like (Main.Listbox1.items.add "lol")

    Because when i add it to the class i get error "Main is not declared"
     
  4. speljohan

    speljohan Guru
    Visual Basic Programmers

    Joined:
    Apr 24, 2005
    Posts:
    1,450
    Referrals:
    3
    Sythe Gold:
    0
    Ceating dlls

    is main your dll? remember that vb.net is object oriented, so you will have to declare a new one like this:
    Code:
    Dim myLibrary As New Main()
    myLibrary.Listbox1.Items.Add("bwahaha")
    Also remember to have a constructor in the Main() class, like this:
    Code:
    Public Sub New()
    'put initialization code here (if you have any)
    End Sub
     
  5. X Zero

    X Zero Forum Addict

    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0
    Ceating dlls

    Let me rephrase


    is it possible to do something like (Form1.Listbox1.items.add "lol")

    Because when i add it to the class i get error "Form1 is not declared"
     
  6. Flaming Idiots

    Flaming Idiots Active Member
    Visual Basic Programmers

    Joined:
    Dec 22, 2005
    Posts:
    235
    Referrals:
    1
    Sythe Gold:
    0
    Two Factor Authentication User
    Ceating dlls

    You need to use "Me" if the method is in the same form. If is from a module, use "My.Forms.{Forms name}".

    Edit: Since when did I have a VB programming rank?
     
  7. speljohan

    speljohan Guru
    Visual Basic Programmers

    Joined:
    Apr 24, 2005
    Posts:
    1,450
    Referrals:
    3
    Sythe Gold:
    0
    Ceating dlls

    and since when did i lose my rank? :p
     
  8. X Zero

    X Zero Forum Addict

    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0
    Ceating dlls

    umm, i mean in the dll theres this code

    Code:
    Public Function ADD() As Integer Implements _Tester.ADD
    Form1.Listbox1.items.add "lol"
    End Function
    I want to add "lol" in a listbox using the dll

    but it says form1 not declerde

    how can i solve this?
     
  9. speljohan

    speljohan Guru
    Visual Basic Programmers

    Joined:
    Apr 24, 2005
    Posts:
    1,450
    Referrals:
    3
    Sythe Gold:
    0
    Ceating dlls

    the DLL doesn't know what form that is.

    Code:
    Public Function ADD(control As ListBox) As Integer Implements _Tester.ADD
    control.items.add "lol"
    End Function
    Use it that way instead, and call it like:
    ADD(listbox1)
     
  10. X Zero

    X Zero Forum Addict

    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0
    Ceating dlls

    u got the idea right

    yer but now it says "listbox not defined"

    waaaaaaaaaaaaaaaaaaaaaaaaa
     
< SmoothMouse (better then my last one) | Rounding up >


 
 
Adblock breaks this site