Results 1 to 14 of 14

Thread: Passing values between forms

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Ireland
    Posts
    99

    Passing values between forms

    Hi Folks
    Anyone know the best way to pass alues between forms?
    Im trying to avoid using Globals.
    Cheers

  2. #2
    why are you trying to avoid using globals?
    Matt Bradbury

    An optimist will claim the glass is half full.
    A pessimist that it is half empty.
    I just think the glass is too big.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Ireland
    Posts
    99
    Ive created an App and now it has to be made comply to company standards

  4. #4
    and company standards say that you can't use global variables?
    Matt Bradbury

    An optimist will claim the glass is half full.
    A pessimist that it is half empty.
    I just think the glass is too big.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Ireland
    Posts
    99
    Yes

  6. #6
    Addicted Member Sanj's Avatar
    Join Date
    Apr 2001
    Location
    in front of my PC
    Posts
    242
    hi

    mormally in my apps if i have a lot of shaered variables then i put it in a modual all the forms can acesses however if u can not do that cus of ur companies coding standards then u can pass the cariables when u call ur subs or functions!!

    Code:
    Sub Add_Responce()
    dim mystring as string
    
          mystring = "Hello it Sanj"
    
          call test(mystring)
    
    end sub
    
    
    Public Sub Test(ByVal Response As String)
    
           msgbox Responce
    
    end sub

    how about sommit like that ...

    btw abouve is not tested!!
    Sanj

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Ireland
    Posts
    99
    Cheers Sanj

    But If I put the shared variables in a module, do I not have to make the sjhared variables global anyway?

  8. #8
    Addicted Member Sanj's Avatar
    Join Date
    Apr 2001
    Location
    in front of my PC
    Posts
    242
    yep of course!!

    how about that example i gave does the help towards a solution u need!

    can u gove me more info so i can help??
    Sanj

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Ireland
    Posts
    99
    Sanj
    Just to verify; You explicitly place 'Global' before the shared variables in your modules?

    I use a lot of Active X objects between forms, which would not suit your above method

  10. #10
    Addicted Member Sanj's Avatar
    Join Date
    Apr 2001
    Location
    in front of my PC
    Posts
    242
    hi mick

    Just to verify; You explicitly place 'Global' before the shared variables in your modules?
    the answer is no...well i dont anyway!!

    i use the keyword Public

    This is what i extracted from the help
    Variables declared using the Public statement are available to all procedures in all modules in all applications unless Option Private Module is in effect; in which case, the variables are public only within theproject in which they reside.
    would that be OK for u to Use
    Sanj

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Ireland
    Posts
    99
    Sanj
    Thats bang on. I just want to avoid using the 'Global' type. Publics although they are essentially the same thing.
    Cheers for your help Sanj

  12. #12
    Addicted Member Sanj's Avatar
    Join Date
    Apr 2001
    Location
    in front of my PC
    Posts
    242

    Talking

    No probs mate

    glad to be of assitance
    Sanj

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Ireland
    Posts
    99
    What I meant to say Sanj is thet although Publics are essentially the same thing as Globals, they are allowed within the constraints of my comapany standards.
    Cheers

  14. #14
    Addicted Member Sanj's Avatar
    Join Date
    Apr 2001
    Location
    in front of my PC
    Posts
    242
    glad we got round it

    Sanj

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