-
Passing Arguments
[Originally posted by Terry Ward]
How do I pass information/data/text between forms?
-
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
-
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.
-
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.
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks