473,320 Members | 2,189 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,320 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 1666
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 =...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.