Results 1 to 3 of 3

Thread: How do i get a varible to go from one form to another

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    youngstown, oh
    Posts
    11
    How do i get a varible to go from one form to another

    if you want to see the code email
    raptorautolycud@hotamil.com

  2. #2
    Guest
    One way is to use a public variable in a .BAS module and use this public from both forms.

    Another way is to put a public variable at the form level in the second form and load the second form from the first form, set the variable, then show the second form. If you put a public variable at the form (general declarations) level on a form it can be easily accessed with form.variablename notation just like any other form property/method. It's kind of like adding a rough property to your form (without the Property Let/Get routines). For example, in your second form you might have something like (at the general declarations section):

    Public Incoming As Variant

    From the first form you could then do something like:

    Load Form2
    Form2.Incoming = "hello world!"
    Form2.Show


    Paul


  3. #3
    Lively Member
    Join Date
    Aug 2000
    Location
    Ontario, Canada
    Posts
    79
    Either use a Public Variable or Property in the Form code:

    Code:
      Public sPublicVar as String
      Private sPrivateVar as String
    
      Property Get PrivateVar() as String
        PrivateVar = sPrivateVar
      End Property
      Property Set PrivateVar(ByVal sIn as String)
        sPrivateVar = sIn
      End Property

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