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. Why public sub new()

Why public sub new()

Scheduled Pinned Locked Moved Visual Basic
csharpquestion
4 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hai, I have seen the use of Public sub new() in VB.net. What is the use of that?I will apreciate if somebody can give me a brief idea about that. Similarly what we can use in C# instead od Public sub new(). Please show me the right way. Thank You, Rahul

    D J 2 Replies Last reply
    0
    • L Lost User

      Hai, I have seen the use of Public sub new() in VB.net. What is the use of that?I will apreciate if somebody can give me a brief idea about that. Similarly what we can use in C# instead od Public sub new(). Please show me the right way. Thank You, Rahul

      D Offline
      D Offline
      Daniel1324
      wrote on last edited by
      #2

      Public Sub New() is whats called the constructor for a class in VB. In there, you can set variables to default values, or other stuff thats required for the class to work properly. C# is a little different...

      1 Reply Last reply
      0
      • L Lost User

        Hai, I have seen the use of Public sub new() in VB.net. What is the use of that?I will apreciate if somebody can give me a brief idea about that. Similarly what we can use in C# instead od Public sub new(). Please show me the right way. Thank You, Rahul

        J Offline
        J Offline
        J4amieC
        wrote on last edited by
        #3

        C# uses the class name for constructor with no return type.

        public class MyClass
        {
           // ctor
           public MyClass()
           {}
        }
        
        S 1 Reply Last reply
        0
        • J J4amieC

          C# uses the class name for constructor with no return type.

          public class MyClass
          {
             // ctor
             public MyClass()
             {}
          }
          
          S Offline
          S Offline
          SIJUTHOMASP
          wrote on last edited by
          #4

          Hai Danie,j4amieC, Thanks much for the help. Thank You, Rahul. SoftwareDeveloper(.NET)

          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