Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

include files

Status
Not open for further replies.

theemperor

Programmer
May 22, 2001
28
AT
Hi there! My problem is that I'm a web-programme and therefore do not know how to include files in VB. I tried it with the "include file"-statement as it is common in VBScript, but this actually doesn't work! Can anybody tell me how I can include a file where I defined a bunch of constants in my main module and which extension do I have to use for this file?

thx in advance

Robert
 

Select 'add module' from the 'project' menu (or right click in the project explorer). The extension must be '.bas'

Sunaj
 
thanx a lot for the response...I have tried to do it the way you told me, but somehow it doesn't work. I get a compile error, telling me that the variable (const in my case) is not defined. I use the const in a private function. Is there a problem with the visability and are constants public by default?

thx, Robert
 
Hi

When you dim constants in a bas module and want to use them outside the module, You have to dim them as public:

Public const MyConst= "MyValue"

Sunaj
 
You can declare constant private or public (default = private).
Declare your constant like Public Const Mystring = "HELP" in the BAS module and you can use Mystring in every form and module in your project.
For more information search for Const in VB Help.

Succes, Herman :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top