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. module - what is this

module - what is this

Scheduled Pinned Locked Moved Visual Basic
comquestion
4 Posts 2 Posters 1 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.
  • T Offline
    T Offline
    Tom Wright
    wrote on last edited by
    #1

    I've come across some sample code and at the top of the code, after the imports and before the class declaration, it says module BLAH. What is a module. I've never seen this before. Thanks Tom

    Tom Wright tawright915@gmail.com

    L 1 Reply Last reply
    0
    • T Tom Wright

      I've come across some sample code and at the top of the code, after the imports and before the class declaration, it says module BLAH. What is a module. I've never seen this before. Thanks Tom

      Tom Wright tawright915@gmail.com

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

      MSDN says: A Module statement defines a reference type available throughout its namespace. A module (sometimes called a standard module) is similar to a class but with some important distinctions. Every module has exactly one instance and does not need to be created or assigned to a variable. Modules do not support inheritance or implement interfaces. Notice that a module is not a type in the sense that a class or structure is — you cannot declare a programming element to have the data type of a module. You can use Module only at namespace level. This means the declaration context for a module must be a source file or namespace, and cannot be a class, structure, module, interface, procedure, or block. You cannot nest a module within another module, or within any type. For more information, see Declaration Contexts and Default Access Levels. A module has the same lifetime as your program. Because its members are all Shared, they also have lifetimes equal to that of the program. Modules default to Friend (Visual Basic) access. You can adjust their access levels with the access modifiers. For more information, see Access Levels in Visual Basic. All members of a module are implicitly Shared. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


      T 1 Reply Last reply
      0
      • L Luc Pattyn

        MSDN says: A Module statement defines a reference type available throughout its namespace. A module (sometimes called a standard module) is similar to a class but with some important distinctions. Every module has exactly one instance and does not need to be created or assigned to a variable. Modules do not support inheritance or implement interfaces. Notice that a module is not a type in the sense that a class or structure is — you cannot declare a programming element to have the data type of a module. You can use Module only at namespace level. This means the declaration context for a module must be a source file or namespace, and cannot be a class, structure, module, interface, procedure, or block. You cannot nest a module within another module, or within any type. For more information, see Declaration Contexts and Default Access Levels. A module has the same lifetime as your program. Because its members are all Shared, they also have lifetimes equal to that of the program. Modules default to Friend (Visual Basic) access. You can adjust their access levels with the access modifiers. For more information, see Access Levels in Visual Basic. All members of a module are implicitly Shared. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


        T Offline
        T Offline
        Tom Wright
        wrote on last edited by
        #3

        So do I access the subs and functions of a module as if they were in my code? I do not need to declare it or instantiate it? Tom

        Tom Wright tawright915@gmail.com

        L 1 Reply Last reply
        0
        • T Tom Wright

          So do I access the subs and functions of a module as if they were in my code? I do not need to declare it or instantiate it? Tom

          Tom Wright tawright915@gmail.com

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

          Hi, I suggest you try it. And look it up on MSDN. Or read a book on VB.NET In fact the combination of these is the best way to make real progress. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


          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