473,385 Members | 1,387 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,385 software developers and data experts.

shared...

When you say shared in vb what does it exactly mean... the other languages
use static in the same place of this in .NET here is an example

[Visual Basic]
Public Shared Event Idle As EventHandler

Shared = Static according to the .net documenation ive read... in c++ we
used static to mean a value that stayed there all the time such as a counter
that kept track of how many times a class member was called from any number
of instantiations... for an example... a item that stayed in memory over any
number of instantiations... what does this shared clause mean in vb? is it
similar to what i described or diffrent.. thanks!
Nov 20 '05 #1
9 2839
* "Brian Henry" <brianiup[nospam]@adelphia.net> scripsit:
When you say shared in vb what does it exactly mean... the other languages
use static in the same place of this in .NET here is an example

[Visual Basic]
Public Shared Event Idle As EventHandler

Shared = Static according to the .net documenation ive read... in c++ we
used static to mean a value that stayed there all the time such as a counter
that kept track of how many times a class member was called from any number
of instantiations... for an example... a item that stayed in memory over any
number of instantiations... what does this shared clause mean in vb? is it
similar to what i described or diffrent..


VB.NET's 'Shared' is the same as C#'s 'static' (and very similar to
C++'s 'static'). Nevertheless, in VB.NET we say "The shared member
belongs to /all instances/ of a class (even if no instance exists)", in
C# it would read "The static member doesn't belong to any instance, it
belongs to the class".

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

In VB, the "shared" keyword marks the member as shared between all instances
of that class, so I guess you could think it as the same as the "static"
keyword in C++. I don't have much experience in C++, but from your
definition, they are the same.

VB does have a "static" keyword, but this is reserved for local function
variables that persist their state between function calls.

In VB.net a module acts like a shared class - it's the same as a class that
has all its members marked with the "shared" keyword.

Have a look at
http://msdn.microsoft.com/library/de...akeyShared.asp

for more information.

HTH,

Trev.

"Brian Henry" <brianiup[nospam]@adelphia.net> wrote in message
news:eH**************@TK2MSFTNGP09.phx.gbl...
When you say shared in vb what does it exactly mean... the other languages
use static in the same place of this in .NET here is an example

[Visual Basic]
Public Shared Event Idle As EventHandler

Shared = Static according to the .net documenation ive read... in c++ we
used static to mean a value that stayed there all the time such as a counter that kept track of how many times a class member was called from any number of instantiations... for an example... a item that stayed in memory over any number of instantiations... what does this shared clause mean in vb? is it
similar to what i described or diffrent.. thanks!

Nov 20 '05 #3
* "Brian Henry" <brianiup[nospam]@adelphia.net> scripsit:
When you say shared in vb what does it exactly mean... the other languages
use static in the same place of this in .NET here is an example

[Visual Basic]
Public Shared Event Idle As EventHandler

Shared = Static according to the .net documenation ive read... in c++ we
used static to mean a value that stayed there all the time such as a counter
that kept track of how many times a class member was called from any number
of instantiations... for an example... a item that stayed in memory over any
number of instantiations... what does this shared clause mean in vb? is it
similar to what i described or diffrent..


VB.NET's 'Shared' is the same as C#'s 'static' (and very similar to
C++'s 'static'). Nevertheless, in VB.NET we say "The shared member
belongs to /all instances/ of a class (even if no instance exists)", in
C# it would read "The static member doesn't belong to any instance, it
belongs to the class".

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
thanks, this is what i was thinking it was, i have been searching MSDN for a
meaning of it but never came across just the shared clause... but a bunch of
other stuff named shared :)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...
* "Brian Henry" <brianiup[nospam]@adelphia.net> scripsit:
When you say shared in vb what does it exactly mean... the other languages use static in the same place of this in .NET here is an example

[Visual Basic]
Public Shared Event Idle As EventHandler

Shared = Static according to the .net documenation ive read... in c++ we
used static to mean a value that stayed there all the time such as a counter that kept track of how many times a class member was called from any number of instantiations... for an example... a item that stayed in memory over any number of instantiations... what does this shared clause mean in vb? is it similar to what i described or diffrent..


VB.NET's 'Shared' is the same as C#'s 'static' (and very similar to
C++'s 'static'). Nevertheless, in VB.NET we say "The shared member
belongs to /all instances/ of a class (even if no instance exists)", in
C# it would read "The static member doesn't belong to any instance, it
belongs to the class".

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #5
thanks, this is what i was thinking it was, i have been searching MSDN for a
meaning of it but never came across just the shared clause... but a bunch of
other stuff named shared :)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...
* "Brian Henry" <brianiup[nospam]@adelphia.net> scripsit:
When you say shared in vb what does it exactly mean... the other languages use static in the same place of this in .NET here is an example

[Visual Basic]
Public Shared Event Idle As EventHandler

Shared = Static according to the .net documenation ive read... in c++ we
used static to mean a value that stayed there all the time such as a counter that kept track of how many times a class member was called from any number of instantiations... for an example... a item that stayed in memory over any number of instantiations... what does this shared clause mean in vb? is it similar to what i described or diffrent..


VB.NET's 'Shared' is the same as C#'s 'static' (and very similar to
C++'s 'static'). Nevertheless, in VB.NET we say "The shared member
belongs to /all instances/ of a class (even if no instance exists)", in
C# it would read "The static member doesn't belong to any instance, it
belongs to the class".

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #6
Brian,

* "Brian Henry" <brianiup[nospam]@adelphia.net> scripsit:
thanks, this is what i was thinking it was, i have been searching MSDN for a
meaning of it but never came across just the shared clause... but a bunch of
other stuff named shared :)


<http://msdn.microsoft.com/library/en-us/vsintro7/html/vxoriLanguageEquivalentsKeywords.asp>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #7
Brian,

* "Brian Henry" <brianiup[nospam]@adelphia.net> scripsit:
thanks, this is what i was thinking it was, i have been searching MSDN for a
meaning of it but never came across just the shared clause... but a bunch of
other stuff named shared :)


<http://msdn.microsoft.com/library/en-us/vsintro7/html/vxoriLanguageEquivalentsKeywords.asp>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
ooo thanks, thast a nice piece of documentation there!

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OR**************@TK2MSFTNGP09.phx.gbl...
Brian,

* "Brian Henry" <brianiup[nospam]@adelphia.net> scripsit:
thanks, this is what i was thinking it was, i have been searching MSDN for a meaning of it but never came across just the shared clause... but a bunch of other stuff named shared :)

<http://msdn.microsoft.com/library/en...nguageEquivale
ntsKeywords.asp>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #9
ooo thanks, thast a nice piece of documentation there!

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OR**************@TK2MSFTNGP09.phx.gbl...
Brian,

* "Brian Henry" <brianiup[nospam]@adelphia.net> scripsit:
thanks, this is what i was thinking it was, i have been searching MSDN for a meaning of it but never came across just the shared clause... but a bunch of other stuff named shared :)

<http://msdn.microsoft.com/library/en...nguageEquivale
ntsKeywords.asp>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #10

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

Similar topics

10
by: John Brock | last post by:
I have a base class with several derived classes (I'm writing in VB.NET). I want each derived class to have a unique class ID (a String), and I want the derived classes to inherit from the base...
96
by: BadPony | last post by:
Anyone using Peoplesoft on a Federated UDB (shared nothing)Environment on Open System Platforms? Preferably AIX, but any war stories would be good. TEA EB-C
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'...
1
by: Henri | last post by:
Hi, I'm using a custom class in my ASP.NET which has a Shared property. I don't want this Shared property to be shared between users because of thread concurrent accesses problems. I just want it...
2
by: tshad | last post by:
I have a program I am trying to compile into a dll and am getting a bunch of: the following errors: error BC30469: Reference to a non-shared member requires an object reference. At first, I...
11
by: tshad | last post by:
I am setting up some of my functions in a class called MyFunctions. I am not clear as to the best time to set a function as Shared and when not to. For example, I have the following bit...
15
by: Rob Nicholson | last post by:
A consequence of the ASP.NET architecture on IIS has just hit home with a big thud. It's to do with shared variables. Consider a module like this: Public Module Functions Public GlobalName As...
5
by: Erik Cruz | last post by:
Hello! I have read some threads discussing the fact that a module is in reality a shared class. If I try to create a Public Shared Class in vb.net I receive a compile error. Why? If I can't...
5
by: Simon | last post by:
Hi all, We have an ASP.NET 1.1 application running on IIS6 on Server 2003. Most of the base objects we are using in this application are taken from a windows application also written by us. We...
11
by: eBob.com | last post by:
I have this nasty problem with Shared methods and what I think of as "global storage" - i.e. storage declared outside of any subroutines or functions. In the simple example below this "global"...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.