Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Global And Public Whats The Difference!?

Global connect as New ADODB.Connection

Public connect as New ADODB.Connection

whats the difference between this two....?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Difference Between Public And Global
hey anyone could differentiate me about global and public declarations, how about declaring them in different modules (e.g. the public x as string in module1 and global y as string in module2),

how about a procedure with a public declaration and the other is only sub... here is the example

' this is in the module1
Sub Test
End Sub

' this is in the module2
Public Sub Test2
End Sub

I'm just confused what's their differences... thanx...

Difference Between Global And Public

What is the Difference between Global and Public.
For example.

Global Const KONSTANT=1000
Public Const KONSTANT=1000

Thanks in advance.


Public And Global Variables - Difference ?

What is the difference between public and Global variables ?

both of them are accessible for entire application. so what is the difference?

Where you will use global and where you will use public ?

please explain with examples (if possible)


Hi, Public And Global Variable Declarations..difference??
What is the difference between declaring a Global and a Public variable in a standard module?

I have tried the two below and they both work, but what is the difference between Public and Global?

"Global Username As String"


"Public Username As String"



Difference Between Global Variable And Public Variable Is BAS Module
What is the difference between a Global Variable declared and a public varibale declared in BAS Module

for example in a BAS Module MyModule I am declaring the two varibles as follows

Public MyPublicName    as String
Global MyGlobalName    as String

Now i can use both the variable through out the project.

If so what is the difference between these two variables.


Whats The Difference?
whats the difference between Len and LenB function? when should i use the first and when the second one?

Whats The Difference?
hi there,

umm.. jus wondering whats the difference between Visual Basic and Visual Studio?

☆ :::P::: :::E::: :::R::: :::F::: :::E:::! :::C:::! :::T::: ☆

Whats The Difference?
Hey, have recently bought a Visual Basic CCE(control create edition) What would the difference be to for example Visual Basic Pro. And if there is a major difference how much would a Visual Basic Pro cost?


Whats The Difference
what is the point of haveing a form activate and a form load event?

i mean, what kind of stuff would you want to do in the form activate?
form activate triggers even before the form is on-screen right?

Whats The Difference ?
... between Form Show/Hide and Form Visible True/False ?

Anyone ?

Ini, Inf Whats The Difference
what is the difference between a *.INI and a *.INF file??


Whats The Difference Between && And +?
strCommand = "GET " + Right(URL, Len(URL) - Len(strSvrURL) - 7) + " HTTP/1.0" + vbCrLf

the same as
strCommand = "GET " & Right(URL, Len(URL) - Len(strSvrURL) - 7) & " HTTP/1.0" & vbCrLf


Whats The Difference???
Can someone tell me the difference between a method and a function? is it that a method only applies to a specific object??



Whats The Difference.....
Could anyone tell me what the difference is between a class module and a module. It's been bugging me for a long time now. TIA


Whats The Difference?

I'm new to visual basic and have what I hope is not a dumb question..

Could someone tell me (or point me in the direction where i can find more info) what is the main difference between visual basic, VBA, and VBScript.....


Whats The Difference?
Could someone explain the diffence of a reference and a component? Both of these are found in the project menu.

Whats The Difference Between...
Can someone explain the difference between :

Dim MyArray() as byte


Dim MyArray() as String * 1

I need to write a long string to an array, and I was wondering which type of array would be more suitable for rapid calculations.

This will be part of an Encryption DLL so i'll need testers later on if anyone is interested.


Whats The Difference Between VB6 And VBA

I was thinking about taking some courses in Visual Basic at my university, and I'm not sure what the difference is between VB6 and VBA.

Can anyone enlighten me about what VBA is? I am thinking about applying to a work as a VB programmer, but is VBA better than just plain VB?

Public Vs Global
What is the difference betwen declaring a variable in *.bas file using Public and declaring it using Global

also What is the difference betwen declaring a variable in declaraion section of *.frm, *.cls files using Dim and declaring it using Private

these are newbie questions but i need to refresh my memory

Public Vs. Global
Is Public the same as Global?

Dim? Public?? Global??? Ye Right...
what do we need modules for? cant we put the code in a .frm?
whats dim for, and public, global, and private?

whats the difference between as string, as integer as ...?

Global Public Or Dim?
Wow haven't been here for a while. Anyways, I was wondering what the difference between all the public variable declare types (Global, Public, and Dim) and when I should use which or does it matter?

Global Vs. Public
Just Curious,

In a .bas module, what is the difference between declaring a variable using Global vs declaring a variable using Public? Whenever I've need a variable available to every form (such as 'connection'), I've always declared them using Global. In reading the forums, I've noticed that most responses suggest using Public. Is there a difference? What are the consequences of one vs the other?

Global Or Public?
whats the difference.. when should you use GlobalPublic? do they do the same thing?

Global VS Public
What is the main difference between declaring a variable as public or global in a module??


VB Code:
Option Explicit Global BenefitIndex As Integer'ORPublic BenefitIndex As Integer'...  

Global Vs Public
Whats the difference? EX:

VB Code:
Global strTest As StringPublic strTest2 As String

Whats the difference?

Global Vs Public
I came from a COBOL/PASCAL background. I am used to Global variables. My VB apps use Global variables. I have been reading that I should not use GVs. I should, instead, use PUBLIC variables.

If I go to my modules and change all the GLOBAL variable definitions to PUBLIC defintions, what will I gain (what will I lose)?

I use them as a vehicle for storing data as I transfer between forms when I don't want to leave the previous form open.

Global Vs Public
What is the difference between a global variable and a public variable??

Global And Public
Global and Public vars, any differences, or is it just a result from newer VB versions?

Global && Public
Please advice me the difference between Global and Public keywords.And tell me where they should be used.

Global Over Public
Anyone tell me the differance between Global and Public declarations and why they seem to do the same job.


Global Or Public ?
What is the difference between written:
Global namevariable1
Public namevariable1

Global / Public??
Does anyone know of a difference between using Global and Local to declare public variables (in a standard module)?

Global Vs. Public

What's the difference between these 2 (Global and Public) when it comes to declaring variables?


Global Vs. Public
I am working on a project which has some variables declared as Public and others as Global (in a basic module). I have never used Global before.

Can anyone tell me the difference between Global and Public declarations, and when you would use one over the other?

Thanks in advance,


Global Vs Public
Is there a difference between defining a variable as Global or defining it as Public?
Global giEmpNbr as integer
Public giEmpNbr as integer

I think Public has replaced Global but are there any differences when concerned with memory?

Should I be concerned with deallocating memory in VB? Or does it just happen automatically?

Public Or Global???
Would someone please explain the difference between using Public vs Global
in either variables or constants? I don't see any.


Matthew Wells
Join Bytes!

Global Vs. Public
can anyone tell me the difference between global and public declarations in bas file !!

Global Vs. Public
can anyone tell me the difference between global and piblic declarations in bas file !!

Whats The Difference Between FreeFile And...
Whats the difference between open a file this way:

VB Code:
Dim fileChk, fileNum As Integer        fileChk = GetAttr(strPath)            If Not fileChk <> 0 Then            fileOpen = ""        Else            fileNum = FreeFile                Open strPath For Input As #fileNum                    Line Input #fileNum, fileOpen                Close #fileNum

...and opening it this way:

VB Code:
Dim fileChk As Integer        fileChk = GetAttr(strPath)            If Not fileChk <> 0 Then            fileOpen = ""        Else                Open strPath For Input As #1                    Line Input #1, fileOpen                Close #1


I've seen people do it both ways, but I don't know the difference or which one is better/more practical.

Whats Difference In Using Where And Inner Join ?
Whats the difference between where with = operator and inner join with = operator they both return same result so why use innerjoin instead of where clause?
I need technical difference not like Inner join is sql ansi standard and so on.
is join faster than where clause.

for e.g the below query returns same result if you use join or where clause

MSDN Join referece
FROM Suppliers AS S JOIN Products AS P
     ON (S.SupplierID = P.SupplierID)
WHERE P.UnitPrice > $10
  AND S.CompanyName LIKE N'F%'

using where clause

FROM Suppliers AS S, Products AS P
WHERE S.SupplierID = P.SupplierID
  AND P.UnitPrice > $10
  AND S.CompanyName LIKE N'F%'


Mind is faster than Wind --- Mahabharat

Diffference Public && Global
What is the difference between declaring a variable global or public in a module?

global x as integer


public x as integer

seems to me the both work the same. I can use them both in another form

Global/Public Vs Private
Ok - one thing I love to do is use Global (which I've been told to use Public recently instead). This way I can call any variable and change it from anywhere. However, it seems people think it's a bad idea!

I'm wondering why private is better, and how much more work they are.

it seems Private can only be called by the procedure/function/body it was created in. Doesn't that make them super hard to work with when you need the info on multiple forms at times?

Global V.S. Public/PrivateHi,/Dim
What is different between Global V.S. Public/Private/Dim?
Also what is index of index.php)?

i wonder where the difference lies. and can you mention examples where it is more appropriate to use one type over the other???

thanks in advance!

Diff Between Global And Public
Hi All,

Plz tell me what is the difference between Gloabl variable and public variable. When i tried to define a function "Global Function ABC as string" then Global keyword vanished automatically and only remains "Function ABC as string". This is not happened when i defined variable as Global str as string.


Global, Public And The HEAP
Trying to clear up in my own mind what's going on or is this compiler specific?

VB Code:
1.  Global MODULE variable       a.  When created it is stored on the heap?     b.  If it is a string is 256 character set aside at this point          or is just a empty string created?     c.  Stays on heap for entire life of process?     d.  If string set to "", most of the heap space is reclaimed?  2.  Public Form variable      a.  When created is it stored on the heap?     b.   If it is a string is 256 characters set aside at this point           or is just a empty string created?     c.   Removed from heap when form destroyed?

Public/global Variables

I have a pretty large application and I'm beginning to wonder about all the public/global variables that I have.

I have maybe 25 or 30 application wide options that I keep in a public Type construct. Rather than reading the INI file or database for these options every single time I need them I thought this would be better. I also have maybe 10 or so other public/global variables in here as well.

Is this too much?

I always hear people ***** and moan about using global variables, but with today's computers is it really an issue?

I'd like some feedback.


Global Vs. Public *RESOLVED*
I think this is an easy one...i'm just stupid
What is the difference of these two variable declarations if they are both in a BAS module?

Global SomeGlobalVariable as Integer
Public SomePublicVariable as Integer

Copyright 2005-08, All rights reserved