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

default access modifier for a sub or a function when not set


Please help.

What is the default access modifier value for a Sub or a Function when one
has not explicitly been set.

In MSDN, in "Access Types", it states...

"If no access modifier has been specified, the default access type depends
on the declaration context"

....which, although interesting, is somewhat less than direct.

Let's suppose a simple case. There is an ASPX page as the UI and an ASPX.VB
page as the code-behind logic. Now, if someone opens that ASPX.VB file and
simply writes a method such as...

Sub DoSomething()


End Sub

....what default access modifier is applied to this method?

Please advise.

Thank you.


Nov 19 '05 #1
1 5581

"Mark Kamoski" <mk******@yahoo.com> schrieb:
What is the default access modifier value for a Sub
or a Function when one has not explicitly been set. [...] simply writes a method such as...

Sub DoSomething()


End Sub

...what default access modifier is applied to this method?

Class Foo
Sub Bla()
End Sub
End Class

will declare Foo as Friend and Bla as Public. Open the object browser
to check the modifier. I always specify the modifier...


Herfried K. Wagner
MVP VB Classic, VB .NET
Nov 19 '05 #2

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

Similar topics

by: Dan Disney | last post by:
I have read conflicting information on the access scope of VB.Net class declarations when no access modifier is specified. MSDN library documentation states "Classes that do not specify an access...
by: N Khan via .NET 247 | last post by:
Hi, I know the usage of access modifier ?public? in DLL assembliesbut I am a bit puzzled that if let say I have a public class inan exe assembly then what purpose access modifier ?public?...
by: Jacob N. Rohde | last post by:
Hi guys, I was under the assumption that the default type access modifier for classes/structs is internal. But the MCAD Study Guide (from MS even) says public?!?! (The Dr. GUI .NET tutorial from...
by: Mr Newbie | last post by:
I am messing around with Web User Controls at present and (think) I have discovered the following. 1.) The identifier for the control in the code behind must match the ID for the control on the...
by: Harold Hsu | last post by:
Hi all, What's the default access type of a property declared in an interface? The one I'm looking at is IBindingList: Public Interface IBindingList .... ReadOnly Property AllowEdit As...
by: prefersgolfing | last post by:
I'm trying to find on MSDN, or someplace, that speaks to variables being public or private by default. Anyone know where? Thanks.
by: Tony Johansson | last post by:
Hello!! If you write private class Test {} you have a private class If you write public class Test {} you have a public class If you write protected class Test {} you have a protected class If...
by: RitualDave | last post by:
This compiles and runs successfully in VS2005: ref class A { private: ~A() { this->!A(); } // private! !A() { } // private! }; ....
by: Richard Coltrane | last post by:
Hi there, The docs say that default access modifier is internal. My own experience has been that it is internal. And yet almost every website Ive seen on the web tries to tell me its public?? Am...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.