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. Static / Shared block

Static / Shared block

Scheduled Pinned Locked Moved Visual Basic
csharpjavaquestion
5 Posts 3 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.
  • D Offline
    D Offline
    divyesh1432
    wrote on last edited by
    #1

    Can we have a static block in VB.net just like we have in java ? If yes can you please provide me a syntax for it !

    C D 2 Replies Last reply
    0
    • D divyesh1432

      Can we have a static block in VB.net just like we have in java ? If yes can you please provide me a syntax for it !

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Your question gives the answer. A static method or property in VB is called Shared.

      Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

      D 1 Reply Last reply
      0
      • D divyesh1432

        Can we have a static block in VB.net just like we have in java ? If yes can you please provide me a syntax for it !

        D Offline
        D Offline
        Dave Doknjas
        wrote on last edited by
        #3

        A 'static' initializer block in Java is really just a static constructor. So... class Foo { static { ... } } just converts to: Friend Class Foo Shared Sub New() ... End Sub End Class (via 'Java to VB & C# Converter') David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter VB & C# to Java Converter Java to VB & C# Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++/CLI

        D 1 Reply Last reply
        0
        • D Dave Doknjas

          A 'static' initializer block in Java is really just a static constructor. So... class Foo { static { ... } } just converts to: Friend Class Foo Shared Sub New() ... End Sub End Class (via 'Java to VB & C# Converter') David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter VB & C# to Java Converter Java to VB & C# Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++/CLI

          D Offline
          D Offline
          divyesh1432
          wrote on last edited by
          #4

          ok thanks i go through it

          1 Reply Last reply
          0
          • C Christian Graus

            Your question gives the answer. A static method or property in VB is called Shared.

            Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

            D Offline
            D Offline
            divyesh1432
            wrote on last edited by
            #5

            thanks Christian Graus

            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