Results 1 to 4 of 4

Thread: global variables

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    12
    I want to use a variable over different frames. Can anyone tell me how to create the variable and how to fill it in another frame?

  2. #2
    Lively Member
    Join Date
    Feb 2000
    Posts
    118

    just a guess

    I'm assuming you mean forms. Add a module and declare it there
    Kokopeli
    VB6 SP3

  3. #3
    Hyperactive Member WP's Avatar
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    278

    Wink Public

    There are several ways to do this:
    -Dim: Use Dim in a procedure the dim the variable only for that procedure. Use Dim in the Declarations of a form to dim it for the whole form.
    -Public: Use Public in the declarations of your form or module to dim it for your whole project.

    Example:
    Code:
    Option Explicit
    Dim MyVar As String 'Only for this form or module
    Public MyVar As String 'For the whole project :)
    I hope this helped you

    WP

    Visual Basic 6.0 EE SP5 / .Net
    Windows XP

  4. #4
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    You can even declare your functions and subs as Public in a Form. So you can call them also in any form or module...

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