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. C#
  4. Constructor - Load method

Constructor - Load method

Scheduled Pinned Locked Moved C#
question
9 Posts 5 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.
  • P Offline
    P Offline
    pat270881
    wrote on last edited by
    #1

    Hello, I have a Form of a Smart Device Application with a constructor and a defined Form_Load event. When i the form is created which method is first executed - the constructor or the Form_Load?? regards pat

    S C 2 Replies Last reply
    0
    • P pat270881

      Hello, I have a Form of a Smart Device Application with a constructor and a defined Form_Load event. When i the form is created which method is first executed - the constructor or the Form_Load?? regards pat

      S Offline
      S Offline
      SandeepN
      wrote on last edited by
      #2

      You can quickly check this by putting breakpoint in both Constructor and Form_Load method and run it. See which one gets called first... Sandeep Naik

      M 1 Reply Last reply
      0
      • S SandeepN

        You can quickly check this by putting breakpoint in both Constructor and Form_Load method and run it. See which one gets called first... Sandeep Naik

        M Offline
        M Offline
        Matt Gerrans
        wrote on last edited by
        #3

        Or with logic: does it make sense for any method to be called before a constructor? By the way, if you have multiple constructors and you're using the debugger method suggested, may want to put breakpoints in all of them. Matt Gerrans

        H 1 Reply Last reply
        0
        • P pat270881

          Hello, I have a Form of a Smart Device Application with a constructor and a defined Form_Load event. When i the form is created which method is first executed - the constructor or the Form_Load?? regards pat

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          When instantiating ANY class, the constructor is always the first thing that is called.


          Do you want to know more?


          Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.

          M H 2 Replies Last reply
          0
          • C Colin Angus Mackay

            When instantiating ANY class, the constructor is always the first thing that is called.


            Do you want to know more?


            Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.

            M Offline
            M Offline
            Matt Gerrans
            wrote on last edited by
            #5

            Well, heck, if you were just going to blurt it out, couldn't you have done it in the form of a Vogon poem? ;) Matt Gerrans

            C 1 Reply Last reply
            0
            • M Matt Gerrans

              Well, heck, if you were just going to blurt it out, couldn't you have done it in the form of a Vogon poem? ;) Matt Gerrans

              C Offline
              C Offline
              Colin Angus Mackay
              wrote on last edited by
              #6

              Matt Gerrans wrote: couldn't you have done it in the form of a Vogon poem? I tried once, but I got these intestinal cramps and an inexplicable urge to gnaw off my right leg.


              Do you want to know more?


              Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.

              1 Reply Last reply
              0
              • M Matt Gerrans

                Or with logic: does it make sense for any method to be called before a constructor? By the way, if you have multiple constructors and you're using the debugger method suggested, may want to put breakpoints in all of them. Matt Gerrans

                H Offline
                H Offline
                Heath Stewart
                wrote on last edited by
                #7

                Yes, static methods and type constructors. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

                M 1 Reply Last reply
                0
                • C Colin Angus Mackay

                  When instantiating ANY class, the constructor is always the first thing that is called.


                  Do you want to know more?


                  Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.

                  H Offline
                  H Offline
                  Heath Stewart
                  wrote on last edited by
                  #8

                  Actually, the static initializer (.cctor) is the first thing ever called, but only the first time for a type within a given AppDomain. But as far as instances go, yes you're right. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

                  1 Reply Last reply
                  0
                  • H Heath Stewart

                    Yes, static methods and type constructors. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

                    M Offline
                    M Offline
                    Matt Gerrans
                    wrote on last edited by
                    #9

                    Well, yes, if you want to pick nits. If you insist, instead of "does it make sense for any method to be called before a constructor?" it should be "does it make sense for any instance method to be called before a constructor?" or perhaps "does it make sense for any static method to be called before a type constructor?" or maybe the two combined. Matt Gerrans

                    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