473,289 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

public variable or friend?

D.
Hi,

i come from classic asp and i'm a little confused with variable declaration
in VB.
I read: "A Public variable is accessible from any place within the module it
was declared or other applications which refer to the application where it
was declared".

What does mean 'application'? Is that all the files within an
applicationroot?
And is a module an aspx-file?

So if i declare a public variable, is it correct to say:
- that var. is accessible from any place in the aspx file
- but not from another aspx file in the same application

And finally: what does mean "or other applications which refer to the
application where it was declared"?

Thanks
D

May 12 '06 #1
1 1663
Bad wording...

public is globally accessible to any piece of code. By "application" they
mean "assemblies". So if someone adds an reference to your assembly, they'll
be able to access any public variables. Your assumption is wrong. a public
var is accessible to _everything_ including classes in your own assembly (a
page is just a class), and classes in other assemblies.

A friend is accessible to any class within your assembly, but not outside
assemblies.

private is your class only

protected is your class or child classes (inheritance)

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"D." <d.***@rtt.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hi,

i come from classic asp and i'm a little confused with variable
declaration
in VB.
I read: "A Public variable is accessible from any place within the module
it
was declared or other applications which refer to the application where it
was declared".

What does mean 'application'? Is that all the files within an
applicationroot?
And is a module an aspx-file?

So if i declare a public variable, is it correct to say:
- that var. is accessible from any place in the aspx file
- but not from another aspx file in the same application

And finally: what does mean "or other applications which refer to the
application where it was declared"?

Thanks
D

May 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: | last post by:
We just learned that a variable declared Friend within a module can be shared across multiple user sessions. Is there any way to declare a Friend variable within a module, so that it is...
10
by: darrel | last post by:
I'm still trying to sort out in my head the differences between public and shared when referring to declaring properties or variables. This is my understanding: shared - akin to a 'global'...
17
by: Tom | last post by:
I have written a property, where I want to have the GET be available to anyone (i.e. Public); however, I want the SET to be available ONLY to the class or program itself (i.e. Friend). In VB6...
2
by: Dennis | last post by:
I have read and re-read VB.Net's help on scope of variables but darned if I can understand the difference between Friend and Public variables? -- Dennis in Houston
27
by: thomasp | last post by:
Variables that I would like to make available to all forms and modules in my program, where should I declare them? At the momment I just created a module and have them all declared public there. ...
1
by: timbobd | last post by:
I have encountered a situation that I don't understand. When I call a sub of Friend scope (in an object with Friend scope), I am getting an error "Public member 'subname' not found in type...
0
by: AndyB | last post by:
I'm using xsd.exe to generate a typed-dataset. Then using typed dataset tables (datatables containing two columns--a name and a value) to bind to ASP.NET dropdown list controls (for the dropdown...
3
by: jbeteta | last post by:
Hello, I have a problem declaring variables. I need to create an object oRpte as ReportClass on WebForm1.aspx and be able to use its value on WebForm2.aspx. For declaring the property oRpte()...
9
by: Rudy | last post by:
Hello All! I'm a little confused on Public Class or Modules. Say I have a this on form "A" Public Sub Subtract() Dim Invoice As Decimal Dim Wage As Decimal Static PO As Decimal Invoice =...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.