Results 1 to 4 of 4

Thread: [RESOLVED] Global Variables

  1. #1

    Thread Starter
    Junior Member Stinkylunchmeat's Avatar
    Join Date
    Oct 2005
    Posts
    23

    Resolved [RESOLVED] Global Variables

    I am having trouble acessing Variables that I am declaring in the Module. When I try to use these variables that I declared in the Module [module code](Dim strname as string) I try to use them like [procedure code](txtname.text=strname) they come up as not delcared.

    If anyone can help as to how to use global variables it would be greatly appreciated.

  2. #2
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    Re: Global Variables

    Are they in the same module? If yes, make sure that they come after the Public Class declaration and are not declared inside of another routine. Also, when you make a module-level variable, most folks use Private instead of Dim. If no, try below.

    Try replacing Dim with Public

    Public strName as String

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Global Variables

    Well, if you are using the simple Dim statement to define them, they aren't publicly available (they're private by default). If you use Public instead of Dim, then you should be OK.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Junior Member Stinkylunchmeat's Avatar
    Join Date
    Oct 2005
    Posts
    23

    Talking Re: Global Variables

    Thanks guys!


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