Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Trouble With Access Modifiers

Trouble With Access Modifiers

Scheduled Pinned Locked Moved Visual Basic
question
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fahad Sadah
    wrote on last edited by
    #1

    What access modifier would I use so that: Functions within the class have read and write access to the subject & Anything external has read-only access? Many thanks with this stumping question, Fahad Sadah

    P L 2 Replies Last reply
    0
    • F Fahad Sadah

      What access modifier would I use so that: Functions within the class have read and write access to the subject & Anything external has read-only access? Many thanks with this stumping question, Fahad Sadah

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      Marking a method as Private means it can only be accessed by code within the current class. Marking a method as Friend means it can only be accessed by code within the current assembly. Hope this helps.

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      1 Reply Last reply
      0
      • F Fahad Sadah

        What access modifier would I use so that: Functions within the class have read and write access to the subject & Anything external has read-only access? Many thanks with this stumping question, Fahad Sadah

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        Since .NET 2.0 C# supports properties with different access modifiers for thet get and the set part, so you could have a public get and a private set. Not sure how it is in VB.NET tho. If it is not available, you can always make your own public Get and private Set methods! :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets


        P 1 Reply Last reply
        0
        • L Luc Pattyn

          Since .NET 2.0 C# supports properties with different access modifiers for thet get and the set part, so you could have a public get and a private set. Not sure how it is in VB.NET tho. If it is not available, you can always make your own public Get and private Set methods! :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets


          P Offline
          P Offline
          Paul Conrad
          wrote on last edited by
          #4

          There is get and set in VB.NET

          "The clue train passed his station without stopping." - John Simmons / outlaw programmer

          L 1 Reply Last reply
          0
          • P Paul Conrad

            There is get and set in VB.NET

            "The clue train passed his station without stopping." - John Simmons / outlaw programmer

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Paul Conrad wrote:

            There is get and set in VB.NET

            Yes Paul, I am aware of that, but what I don't know is whether they can have different access modifiers, as was introduced in C# 2.0 :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets


            P 1 Reply Last reply
            0
            • L Luc Pattyn

              Paul Conrad wrote:

              There is get and set in VB.NET

              Yes Paul, I am aware of that, but what I don't know is whether they can have different access modifiers, as was introduced in C# 2.0 :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets


              P Offline
              P Offline
              Paul Conrad
              wrote on last edited by
              #6

              I think they can. But, I could be wrong.

              "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

              L 1 Reply Last reply
              0
              • P Paul Conrad

                I think they can. But, I could be wrong.

                "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #7

                Very informative. Or need I something to decrypt?

                Luc Pattyn [Forum Guidelines] [My Articles]


                this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets


                P 1 Reply Last reply
                0
                • L Luc Pattyn

                  Very informative. Or need I something to decrypt?

                  Luc Pattyn [Forum Guidelines] [My Articles]


                  this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets


                  P Offline
                  P Offline
                  Paul Conrad
                  wrote on last edited by
                  #8

                  Luc Pattyn wrote:

                  Very informative.

                  :laugh: Sorry :-O

                  Luc Pattyn wrote:

                  need I something to decrypt?

                  Nope. No rijndael or anything like that. Just opening up VS right now to see if it can be done...

                  "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                  F 1 Reply Last reply
                  0
                  • P Paul Conrad

                    Luc Pattyn wrote:

                    Very informative.

                    :laugh: Sorry :-O

                    Luc Pattyn wrote:

                    need I something to decrypt?

                    Nope. No rijndael or anything like that. Just opening up VS right now to see if it can be done...

                    "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                    F Offline
                    F Offline
                    Fahad Sadah
                    wrote on last edited by
                    #9

                    Thanks everyone, trying it now! EDIT: Works perfectly! THANKS!

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups