CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1

    Variable in form used in module?

    I'm using a variable declared in declarations on a frmMain. I'm trying to use that same variable in a module, but the code can't see it. What's the correct syntax for this?


  2. #2
    Join Date
    Dec 1999
    Location
    Malaysia
    Posts
    56

    Re: Variable in form used in module?

    Ok,
    Let's just say you have another form called frmB which wants to use a variable in frmMain. So here is the variable declaration section in frmMain:


    option Explicit
    public strVar as string




    So, if you want to use "strVar" in frmB, you have to declare this variable in frmMain as "Public".

    Now, let's use it for something in frmB:


    frmMain.strVar = "Hello World!!"




    Hope this helps... =)

    ____________________________________
    The VB Bugs in my Life...

  3. #3

    Re: Variable in form used in module?

    Helped 100%. Thank you.


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

Featured