Results 1 to 3 of 3

Thread: [RESOLVED] Sharing variable between exe and dll projects

  1. #1

    Thread Starter
    Fanatic Member staticbob's Avatar
    Join Date
    Jan 2005
    Location
    Manchestershire, UK Cabbage: I do
    Posts
    619

    Resolved [RESOLVED] Sharing variable between exe and dll projects

    Guys,

    I have a main winform /exe project that has a string variable set as public on the main form. I then have a dll project that needs to see that string variable. How do I declare this so my .dll can see it ?


    VB Code:
    1. Public Class C1SpellCheck
    2.     Dim C1Spell As C1.Win.C1Spell.C1Spell
    3.     Public Sub New()
    4.         C1Spell = New C1.Win.C1Spell.C1Spell
    5.         Dim CDFile As String
    6.         CDFile = 'GlobalVar here
    "I dislike 7 am. If 7 am were a person, I would punch 7 am in the biscuits." - Paul Ryan, DailyRamblings

  2. #2
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Sharing variable between exe and dll projects

    Can't you modify the DLL function to accept a passed in string variable in the new sub?

    ex...
    Public Sub New(ByVal MyString as String)

    MyString would then be the global variable you refer to when declaring a new instance of the class, like below...

    Dim MyCheck as new C1SpellCheck(MyString)

  3. #3

    Thread Starter
    Fanatic Member staticbob's Avatar
    Join Date
    Jan 2005
    Location
    Manchestershire, UK Cabbage: I do
    Posts
    619

    Re: Sharing variable between exe and dll projects

    Yes mate, I'd just figured that out myself. DUH.

    Public Sub New(ByVal CDFile As String)
    C1Spell = New C1.Win.C1Spell.C1Spell

    Thanks for the response.
    Bob
    "I dislike 7 am. If 7 am were a person, I would punch 7 am in the biscuits." - Paul Ryan, DailyRamblings

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width