Passing Arguments


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Passing Arguments

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Passing Arguments

    [Originally posted by Terry Ward]

    How do I pass information/data/text between forms?

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Passing Arguments

    [Originally posted by Nick Dawkes]

    there are many ways:
    The two most obvious are
    Declare some varaibles as public in a bas module
    this then means that the values within them can be accessed by any code in the project, but can also be changed by anycode in the project.

    The other less flexible way but for which you have more control is to create a public sub in each form which then becomes a method for that form ie public sub myshow()
    then instead of doing form.show use form.myshow
    You can then define the vars that you want to pass as arguments ie
    Public sub myshow(var1 as string, var2 as integer etc)

    ˙ 'put code in here for assigning argument to vars˙ local to form

    ˙ me.show
    end sub


    hope this helps
    nick

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Passing Arguments

    [Originally posted by modigliani]

    For forms and objects, another way is to create public properties.

    Public variables are OK in a small project, but in a large project they tend to cause bugs and are generally considered to be poor practice.

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Passing Arguments

    [Originally posted by Nick Dawkes]

    I agree thats why I said whilst all values are available to all code, they can be changed by any piece of code, this can be good but it can be bad. It therefore much more controlled to pass variables as arguments.

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Passing Arguments

    [Originally posted by nesse]

    Test

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center