Public and Private RRS feed

  • Question

  • Is it possible to declare a string as public?

    I know this seems like a stupid question but I am pretty stupid when it comes to VB.

    I want to be able to use a string in all my subs, functions and classes. Is that possible?

    Friday, December 1, 2006 2:23 PM


  • Yes very possible and easily accomplished....


    Globally accessible.....

    Public Module Main

    Public MyString as String = "Blah"

    End Module


    Class Accessible:

    Public CLass MyClass

    Private TheString as String = "BLAHBLAH"

    Public AString as String = "B"


    End CLass

    The first declaration would be available to your entire project, "TheString" would be available only to "MyCLass", Where "AString" would be accesible to MyClass and any objects that have access to "MyClass"...hope that helps...


    Friday, December 1, 2006 2:31 PM