| | |
global variable
![]() |
•
•
Join Date: Dec 2009
Posts: 13
Reputation:
Solved Threads: 0
hi! folks merry christmas and happy new year to all of you
ahhm! i have problem in using the .bas module i mean declaring global varibles from it, I try several times to use the variable that i declared in .bas module but did not work so can you help me.. and give some example program from it
hoping for your kindness
God bless all
ahhm! i have problem in using the .bas module i mean declaring global varibles from it, I try several times to use the variable that i declared in .bas module but did not work so can you help me.. and give some example program from it
hoping for your kindness
God bless all
0
#2 Dec 25th, 2009
Hi, Happy Christmas and Happy New Year.
Lets come to the discussion,
Use Public keyword declare a public variable in a module so that all other modules and forms can access it.
Ex:-
'In a Form (Form1 )
' - Draw a Button (Command Button - cmdSetUser)
' >> Add Form (Form2)
' - Draw a Button (Command Button - cmdShowUser)
But avoid often using global variables.
Lets come to the discussion,
Use Public keyword declare a public variable in a module so that all other modules and forms can access it.
Ex:-
VB Syntax (Toggle Plain Text)
'In a module Public sUserName As String
'In a Form (Form1 )
' - Draw a Button (Command Button - cmdSetUser)
' >> Add Form (Form2)
' - Draw a Button (Command Button - cmdShowUser)
VB Syntax (Toggle Plain Text)
'In Form1 Option Explicit Private Sub cmdSetUser_Click() sUserName = "ABCD" Form2.Show End Sub
VB Syntax (Toggle Plain Text)
'In Form2 Option Explicit Private Sub cmdShowUser_Click() MsgBox sUserName End Sub
But avoid often using global variables.
Last edited by selvaganapathy; Dec 25th, 2009 at 6:08 am.
Selva •
•
Join Date: Dec 2009
Posts: 13
Reputation:
Solved Threads: 0
0
#3 Dec 25th, 2009
hey! thanks brother ur such a generous person now i know how to use it ahhm! bro why do you say that avoid often using global variable is it cause a lot of memory but thanks anyway,
but bro i have a big problem about my project its a lending system
our teacher give this kind of project and he told us to self study only
and you know i have only 1 week to finish it and i dont know what to do bro can you help me pls
but bro i have a big problem about my project its a lending system
our teacher give this kind of project and he told us to self study only
and you know i have only 1 week to finish it and i dont know what to do bro can you help me pls
0
#4 Dec 25th, 2009
When u use global variable, u may face some problems .
See this site for detail. It is common for all the languages. So dont use it often.
Dont worry about your project.
Just try out your project, if u have any doubt u post it here.
Definitely not only myself, any one can help you .. but try from your side is very important .. Do well.
See this site for detail. It is common for all the languages. So dont use it often.
Dont worry about your project.
Just try out your project, if u have any doubt u post it here.
Definitely not only myself, any one can help you .. but try from your side is very important .. Do well.
Selva ![]() |
Similar Threads
- How to define global variable in C# (C#)
- Global variable (C)
- How to set Global Variable (ASP.NET)
- import and global variable in Python (Python)
- global variable (C++)
- Storing a selected item into a global variable (JavaScript / DHTML / AJAX)
- how to get global variable of other movie?? (Graphics and Multimedia)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Help........
- Next Thread: Calling a query to display it on a datagridview
Views: 564 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 7 2007 access activex add ado append application array banned basic blackjack bmp box client coffeehouse college component connectionproblemusingvb6usingoledb convert creative database datareport date delete designer desktop dissertations dissertationthesis error excel filter flex form game header icon ide image inboxinvb installation interaction key keypress listview liveperson machine measure metadata movingranges nice noob number object open oracle os outlook password pause pdf picture pos prime print problem program programmer query random range range-objects record refresh report save search size sort spectateswamp sql struct subroutine table tags textbox time timer variable variables vb vb6 vb6.0 vba visual visualbasic web windows





