Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 16th, 2004, 08:16 AM
Authorized User
 
Join Date: Mar 2004
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to set a global variable?

Hi guys

When connecting for the first time, I want to hold the details of the database in global variables that can be accessed accross multiple modules, I know I can create public variables within a module but how do it do it across modules?

Many thanks for any help here!

Cheers

Ciaran
Reply With Quote
  #2 (permalink)  
Old March 16th, 2004, 08:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: McPherson, Kansas, USA.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you create a public variable in a module (bas) you will be able to access that variable from anywhere within your project. Most of the time I use a global connection object.

Public gCn As ADODB.Connection

I then use a function in a dll/class module to connect to the database I pass the global connection object as a parameter.

Hope this helps.

Larry Asher
Reply With Quote
  #3 (permalink)  
Old March 16th, 2004, 01:51 PM
Authorized User
 
Join Date: Mar 2004
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

Thanks for your help

Cheers

Ciaran
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to declare the global variable in global.asax? calyn_gately ASP.NET 3.5 Basics 0 August 6th, 2008 08:06 PM
how to set a global variable ckbseng ASP.NET 3.5 Basics 1 June 4th, 2008 08:44 AM
comapring global variable value to local variable amhicraig XSLT 6 December 5th, 2007 12:16 PM
Object variable or With block variable not set tparrish Classic ASP Databases 0 May 21st, 2005 06:48 AM
Object variable or with block variable not set spacy ASP.NET 1.x and 2.0 Application Design 0 September 21st, 2004 12:19 AM



All times are GMT -4. The time now is 10:39 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.