Results 1 to 3 of 3

Thread: please help: public variables between forms

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2000
    Posts
    10

    Angry

    Hai there,

    I don't know how to declare a public varible in a standard VB from which I can see in other standard VB forms.

    It seems not difficult but I'm stuck,

    Please reply,
    Chris

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    To access a Public variable in a Form from another form you have to use the name of the form to access that variable.

    If you don't want to to this, then use a module.

    Code:
      'in second form
      msgbox firstForm.VariableName
    Iain, thats with an i by the way!

  3. #3
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    Put in the declarations section of your form:
    Public MyVar as <Datatype>

    and call it from other forms like
    MyForm.MyVar

    Better is though to add a code module to your project (.bas file) and put it in there, that way you don't have to put the formname before the var name.
    Hope this helps

    Crazy D

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