Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 01-20-2006, 07:47 PM   #1
Fully Optimized
 
Dishdog's Avatar
 
Join Date: Feb 2005
Posts: 2,801
Default How to make public variables in VB6?

How,lol?

incase i'm not saying the right thing:
How to make a variable go across/be used in multiply forms.
__________________

__________________
CPU-Intel Pentium 4 630 3.0Ghz / 2MB Cache ~~OS Windows XP SP2
MOBO-Gigabyte 8I915P Duo Pro Intel Socket 775 (PCI-E)~~HDD-Western Digital 160GB(SATA)
PSU-Aspire 500W ATX~~RAM-1GB PC3200 DDR SDRAM (512x2 Dual Channel)
GPU-MSI GeForce 6600 GT(PCI Express)~~Monitor Viewsonic VA902B 19" 8ms~~ ATI TV Wonder Pro (TV Tuner)
~~Still to come~~: eVGA e-GeForce 7800 GT
Dishdog is offline   Reply With Quote
Old 01-21-2006, 01:58 AM   #2
In Runtime
 
Windwaker222's Avatar
 
Join Date: Nov 2004
Posts: 351
Default Re: How to make public variables in VB6?

One way to do it is to create a seperate MODULE file and then when declaring each variable just do :

Global varName as Type

That way all your variables are easy to keep track of.
__________________

__________________
AMD Phenom 9600 / 4GB OCZ Gold / nVidia 8800GT / ASUS Crosshair 4xPCI-E
Windwaker222 is offline   Reply With Quote
Old 01-21-2006, 10:11 PM   #3
Fully Optimized
 
Dishdog's Avatar
 
Join Date: Feb 2005
Posts: 2,801
Default Re: How to make public variables in VB6?

Thanks, i knew it was simple but i couldn't remember how to,lol.

Having a little trouble, by module you mean form right?

Also it's not letting me make an variable array in a global statment.
__________________
CPU-Intel Pentium 4 630 3.0Ghz / 2MB Cache ~~OS Windows XP SP2
MOBO-Gigabyte 8I915P Duo Pro Intel Socket 775 (PCI-E)~~HDD-Western Digital 160GB(SATA)
PSU-Aspire 500W ATX~~RAM-1GB PC3200 DDR SDRAM (512x2 Dual Channel)
GPU-MSI GeForce 6600 GT(PCI Express)~~Monitor Viewsonic VA902B 19" 8ms~~ ATI TV Wonder Pro (TV Tuner)
~~Still to come~~: eVGA e-GeForce 7800 GT
Dishdog is offline   Reply With Quote
Old 01-22-2006, 11:39 AM   #4
In Runtime
 
Windwaker222's Avatar
 
Join Date: Nov 2004
Posts: 351
Default Re: How to make public variables in VB6?

Quote:
Originally Posted by Dishdog
Thanks, i knew it was simple but i couldn't remember how to,lol.

Having a little trouble, by module you mean form right?

Also it's not letting me make an variable array in a global statment.
By module I mean module

http://pages.cpsc.ucalgary.ca/~carma...vb6/module.jpg

Try using PUBLIC name AS type, see if it gives a different result
__________________
AMD Phenom 9600 / 4GB OCZ Gold / nVidia 8800GT / ASUS Crosshair 4xPCI-E
Windwaker222 is offline   Reply With Quote
Old 01-23-2006, 12:05 AM   #5
Fully Optimized
 
Dishdog's Avatar
 
Join Date: Feb 2005
Posts: 2,801
Default Re: How to make public variables in VB6?

Ok the Global/public variable array both work in a module.

now is there anyway i can set the values of the variables in the module? You can't set values in general and thats all it has, is there some code i can enter so i can set the values and change them in the module.

I tried putting it in a class module but it gives me the error that i can't have a variable array public in an object module(same one as before).
__________________
CPU-Intel Pentium 4 630 3.0Ghz / 2MB Cache ~~OS Windows XP SP2
MOBO-Gigabyte 8I915P Duo Pro Intel Socket 775 (PCI-E)~~HDD-Western Digital 160GB(SATA)
PSU-Aspire 500W ATX~~RAM-1GB PC3200 DDR SDRAM (512x2 Dual Channel)
GPU-MSI GeForce 6600 GT(PCI Express)~~Monitor Viewsonic VA902B 19" 8ms~~ ATI TV Wonder Pro (TV Tuner)
~~Still to come~~: eVGA e-GeForce 7800 GT
Dishdog is offline   Reply With Quote
Old 01-23-2006, 11:09 AM   #6
Fully Optimized
 
Dishdog's Avatar
 
Join Date: Feb 2005
Posts: 2,801
Default Re: How to make public variables in VB6?

Ok i figured out how, i don't have the code on me now but i will post it later so other people can see how. Thanks for all the help.

Code:
 
Public Function "Name"()

end function
Then you just call the code up with:
Call "Name"

<EDIT> Do not use any of the quotes, just there to show where to put the name of the function.
__________________
CPU-Intel Pentium 4 630 3.0Ghz / 2MB Cache ~~OS Windows XP SP2
MOBO-Gigabyte 8I915P Duo Pro Intel Socket 775 (PCI-E)~~HDD-Western Digital 160GB(SATA)
PSU-Aspire 500W ATX~~RAM-1GB PC3200 DDR SDRAM (512x2 Dual Channel)
GPU-MSI GeForce 6600 GT(PCI Express)~~Monitor Viewsonic VA902B 19" 8ms~~ ATI TV Wonder Pro (TV Tuner)
~~Still to come~~: eVGA e-GeForce 7800 GT
Dishdog is offline   Reply With Quote
Old 01-31-2006, 07:26 PM   #7
In Runtime
 
extendcradle's Avatar
 
Join Date: Jul 2005
Posts: 276
Default Re: How to make public variables in VB6?

I guess you can't use "" when declaring function..
extendcradle is offline   Reply With Quote
Old 02-01-2006, 02:48 AM   #8
Fully Optimized
 
Dishdog's Avatar
 
Join Date: Feb 2005
Posts: 2,801
Default Re: How to make public variables in VB6?

Nope
__________________
CPU-Intel Pentium 4 630 3.0Ghz / 2MB Cache ~~OS Windows XP SP2
MOBO-Gigabyte 8I915P Duo Pro Intel Socket 775 (PCI-E)~~HDD-Western Digital 160GB(SATA)
PSU-Aspire 500W ATX~~RAM-1GB PC3200 DDR SDRAM (512x2 Dual Channel)
GPU-MSI GeForce 6600 GT(PCI Express)~~Monitor Viewsonic VA902B 19" 8ms~~ ATI TV Wonder Pro (TV Tuner)
~~Still to come~~: eVGA e-GeForce 7800 GT
Dishdog is offline   Reply With Quote
Old 02-01-2006, 02:49 AM   #9
Fully Optimized
 
Dishdog's Avatar
 
Join Date: Feb 2005
Posts: 2,801
Default Re: How to make public variables in VB6?

.....oops meant to edit not quote,lol.
__________________

__________________
CPU-Intel Pentium 4 630 3.0Ghz / 2MB Cache ~~OS Windows XP SP2
MOBO-Gigabyte 8I915P Duo Pro Intel Socket 775 (PCI-E)~~HDD-Western Digital 160GB(SATA)
PSU-Aspire 500W ATX~~RAM-1GB PC3200 DDR SDRAM (512x2 Dual Channel)
GPU-MSI GeForce 6600 GT(PCI Express)~~Monitor Viewsonic VA902B 19" 8ms~~ ATI TV Wonder Pro (TV Tuner)
~~Still to come~~: eVGA e-GeForce 7800 GT
Dishdog is offline   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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 05:47 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0