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

M

Mark Kamoski

Hi--

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.

--Mark
 
H

Herfried K. Wagner

Hello,

Mark Kamoski said:
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...

;-)

Regards,
Herfried K. Wagner
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top