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

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 module
   Public sUserName As String

'In a Form (Form1 )
' - Draw a Button (Command Button - cmdSetUser)
' >> Add Form (Form2)
' - Draw a Button (Command Button - cmdShowUser)

'In Form1
Option Explicit

Private Sub cmdSetUser_Click()
   sUserName = "ABCD"
   Form2.Show
End Sub
'In Form2
Option Explicit

Private Sub cmdShowUser_Click()
   MsgBox sUserName
End Sub

But avoid often using global variables.

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

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.

nice. what kind of problem u faced u not mentioned. so tell it clearly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.