New to VB and using Visual Studio 2008. Trying to declare variables and arrays that can be used outside a specific procedure. I want to make the variable universally available within the program. I think I know how to do the declaration, I just can't find where in the code window to put it. Can't use PUBLIC within a procedure right?

Recommended Answers

All 6 Replies

Thanks. I thought of that, but using Visual Studio, I can't find my way into the module of the project... it only shows me the form. I'm really new at this.

VB's IDE Menu>Project>Add Module

Good Luck

Go to the Project menu and select Add Module. Open a New module and you will see it in the list (Module1).

Thanks! Very cool, I found the module and put the variable declarations in there. Of the six variables, two of them remained unavailable to the code on the form... I got an error message. Those two, which are within a FOR...NEXT loop have to be declared in the form code for the thing to run. I'm using "Public" to declare the variables in the module... is there some other way to declare them so they'll be available even within a loop?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.