|
-
November 15th, 1998, 02:39 AM
#1
VB Q&A 2 simple ones
(1) how do i declare variables at the top of my code? Where/How?
(2) similar to the above where do i put code that needs to be executed imediately at run time.
Thanks
Christopher (I`m still checking the manual)
-
November 15th, 1998, 09:31 AM
#2
Re: VB Q&A 2 simple ones
1) If you want to delcare variables that have scope in the Form ... declare them where it says General ... It is a good idea to type in Option Explicit before doing this, this means that your variables have to be declared.
If you want them to have scope of an event such as button click, declare the variable at the top of the subroutine. You can also declare global variables by creating a bas module.
2) If your project is starting from a form ... the initialization code would go in the Form Load Subroutine. You can also start a project from a sub Main. You create this Subroutine in a bas module you create. Then write whatever code you need to execute as the program is initialized ... to load your form use Form.Load and Form.Show
Gordito
-
November 15th, 1998, 12:06 PM
#3
Re: VB Q&A 2 simple ones(thanks)
I did finaly find the information that allowed me to declare variables.
it seems i also have to use the word Private when declaring them of i get an error about being defined outside a procedure.
As far as intialising my code i`ll try your suggestions.
Thanks.
Christopher
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
|
Click Here to Expand Forum to Full Width
|