Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8708373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:07:25+00:00 2026-06-13T04:07:25+00:00

Can anyone explain me in VB i need to use Public Shared Sub so

  • 0

Can anyone explain me in VB i need to use Public Shared Sub so it can be accessed from another form.

But what this “Public” and “Shared” means?

  • Who is public?
  • With who is shared?

If it is public shared does this means some other software or “some hacker app” can easier have access to this sub and it’s values?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:07:26+00:00Added an answer on June 13, 2026 at 4:07 am

    In VB.NET, Shared is equivalent to static in C# – meaning the member belongs to the class, not an instance of it. You might think that this member is ‘Shared’ among all instances, but this is not technically correct, even though VB.NET will resolve a Shared member though an instance invocation.

    public class1
        public shared something as string
        public somethingelse as string
    end class
    

    The following code illustrates how VB.Net allows you to access these:

    ...
    class1.something = "something" 'belongs to the class, no instance needed
    
    dim x as new class1() with {.somethingelse = "something else"}
    
    Console.WriteLine(x.somethingelse) 'prints "something else"
    
    Console.Writeline(class1.something) 'prints "something" <- this is the correct way to access it
    
    Console.Writeline(x.something) 'prints "something" but this is not recommended!
    ...
    

    Public means any linking assembly can see and use this member.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone explain this code to me? Whats the meaning and how to use
Can anyone explain why this code: {% form_theme form _self %} {% block avo_gallery_upload_widget
Can anyone explain the situations in which we need to make use of temporary
Can anyone explain to me why this program: for(float i = -1; i <
I have few questions related to events. Can anyone explain the exact need of
I try to use autocomplete jquery-ui script, but from the documentation it's explain that
Can anyone explain what they are and why I would need them? What kind
Can anyone explain IEnumerable and IEnumerator to me? For example, when to use it
Can anyone explain why databases tend to use b-tree indexes rather than a linked
Can anyone explain why here a = [] ? 1 : 2 a will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.