Results 1 to 5 of 5

Thread: using modules

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2002
    Location
    la la la you can't see me
    Posts
    46

    using modules

    Okay, I feel stupid again I can't remember how to use a module, since it's been about 3 years since I learned about one. I don't use vb much, and am trying to relearn it.

    take a simple module:

    VB Code:
    1. Module myModule
    2.     Dim sString1 as String
    3. End Module

    How do I use the module in form1, form2, whatever?
    Or, if I am way off base, my ultimate goal is to have sString1 visible to pretty much the entire application (preferably without having to jump through too many hoops)
    What does "formatting drive C..." mean?!

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You'd use:

    MessageBox.Show(myModule.sString1)

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2002
    Location
    la la la you can't see me
    Posts
    46
    not quite....

    I want to be able to access, change, store, everything, just as if I had declared it within the same block. I want to be able to use the same variable in different forms, though.
    What does "formatting drive C..." mean?!

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Originally posted by white_as_snow
    not quite....

    I want to be able to access, change, store, everything, just as if I had declared it within the same block. I want to be able to use the same variable in different forms, though.
    You'd use:

    MessageBox.Show(myModule.sString1)

    or rather

    myModule.sString1

    If it doesn't work its because you dimmed the sString1 instead of declaring it Public. Just make that change and you are in business.

  5. #5

    Thread Starter
    Member
    Join Date
    Oct 2002
    Location
    la la la you can't see me
    Posts
    46
    Yeah... I figured that out a little later... my stupid friend told me not to declare it public, and for some reason I listened. Thanks!
    What does "formatting drive C..." mean?!

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