| View previous topic :: View next topic |
| Author |
Message |
ssaccount Master Cheater
Reputation: 0
Joined: 29 Aug 2007 Posts: 391 Location: Finland
|
Posted: Thu Mar 20, 2008 5:29 pm Post subject: [HELP VB 2008]GLOBAL VARIABLES |
|
|
How can i use global Variables so i can use them in different forms?
_________________
Programming in C++
(Or at least trying to ) |
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Thu Mar 20, 2008 6:09 pm Post subject: |
|
|
| Code: | Option Explicit
Dim GlobalVariable |
Is this what you want?
_________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
Pseudo Xero I post too much
Reputation: 0
Joined: 16 Feb 2007 Posts: 2607
|
Posted: Thu Mar 20, 2008 7:02 pm Post subject: Re: [HELP VB 2008]GLOBAL VARIABLES |
|
|
| ssaccount wrote: | | How can i use global Variables so i can use them in different forms? |
| Code: | | Public <stringname> As String |
_________________
| haxory' wrote: | can't VB do anything??
windows is programmed using VB right? correct me if im wrong.
so all things in windows you have like the start menu is a windows form too. |
|
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Thu Mar 20, 2008 8:07 pm Post subject: |
|
|
Oh, I get the question now.
Add a module to your project and put this in
| Code: | Option Explicit
Public StringNameHere as string |
_________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
Pseudo Xero I post too much
Reputation: 0
Joined: 16 Feb 2007 Posts: 2607
|
Posted: Thu Mar 20, 2008 8:08 pm Post subject: |
|
|
| HornyAZNBoy wrote: | Oh, I get the question now.
Add a module to your project and put this in
| Code: | Option Explicit
Public StringNameHere as string |
|
You don't have to put it in a module, and option explicit isn't required.
_________________
| haxory' wrote: | can't VB do anything??
windows is programmed using VB right? correct me if im wrong.
so all things in windows you have like the start menu is a windows form too. |
|
|
| Back to top |
|
 |
ssaccount Master Cheater
Reputation: 0
Joined: 29 Aug 2007 Posts: 391 Location: Finland
|
Posted: Fri Mar 21, 2008 5:34 am Post subject: |
|
|
ok thx dudes
_________________
Programming in C++
(Or at least trying to ) |
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Fri Mar 21, 2008 9:42 am Post subject: |
|
|
I never learn VB.NET, only VB6. I still think VB6 is better.
_________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Fri Mar 21, 2008 9:02 pm Post subject: |
|
|
To make something "global" you can also use the 'Friend' type. And this would go inside a module, which is how globals should be used anyway. Create a new module then use something, say for a string, like this:
| Code: | | Friend gsMyString as String = Nothing |
Reference:
http://en.allexperts.com/q/Visual-Basic-1048/vb-net-global-variables.htm
_________________
- Retired. |
|
| Back to top |
|
 |
|