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. Form_Load event problem

Form_Load event problem

Scheduled Pinned Locked Moved C#
debugginghelp
5 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.
  • K Offline
    K Offline
    kanchoette
    wrote on last edited by
    #1

    Within my Form I am using

    this.Load += new System.EventHandler(this.ItemForm_Load);

    private void ItemForm_Load(object sender, EventArgs e)
    {
    myDataSet.Merge(mainForm.newDataSet);
    }

    However, the merge does not take place. Placing a breakpoint in the debugger shows that the ItemForm_Load never gets hit. Any pointers would be much appreciated.

    D M 2 Replies Last reply
    0
    • K kanchoette

      Within my Form I am using

      this.Load += new System.EventHandler(this.ItemForm_Load);

      private void ItemForm_Load(object sender, EventArgs e)
      {
      myDataSet.Merge(mainForm.newDataSet);
      }

      However, the merge does not take place. Placing a breakpoint in the debugger shows that the ItemForm_Load never gets hit. Any pointers would be much appreciated.

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

      Where are you subscribing to the Load event? If it's after it's loaded it's never going to get called again. If it's not already there, put it in the constructor.

      Dave
      BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
      Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
      Why are you using VB6? Do you hate yourself? (Christian Graus)

      K 1 Reply Last reply
      0
      • D DaveyM69

        Where are you subscribing to the Load event? If it's after it's loaded it's never going to get called again. If it's not already there, put it in the constructor.

        Dave
        BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
        Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
        Why are you using VB6? Do you hate yourself? (Christian Graus)

        K Offline
        K Offline
        kanchoette
        wrote on last edited by
        #3

        Many thanks for your reply. I had my load subscription within

        private void InitializeComponent()
        {

        }

        L 1 Reply Last reply
        0
        • K kanchoette

          Many thanks for your reply. I had my load subscription within

          private void InitializeComponent()
          {

          }

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

          Hi, InitializeComponent() is the one method created and maintained by Visual Studio; you should not edit this method (and, since VS8 or VS9 it normally is in a separate file, based on C#3.0 partial classes, so you shouldn't even edit the entire myForm.designer.cs files Having it in there, is technically as good as having it in the Form's constructor, so the problem must be elsewhere. With the little info you have provided, I can't help you any further though. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


          1 Reply Last reply
          0
          • K kanchoette

            Within my Form I am using

            this.Load += new System.EventHandler(this.ItemForm_Load);

            private void ItemForm_Load(object sender, EventArgs e)
            {
            myDataSet.Merge(mainForm.newDataSet);
            }

            However, the merge does not take place. Placing a breakpoint in the debugger shows that the ItemForm_Load never gets hit. Any pointers would be much appreciated.

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            I'm confused, why are you manually maintaining the form load event handler. If you double click on the forms title bar VS creates this in the Designer.cs as with any other event wiring. I only ever do this if I have multiple subscribers to a single event or I'm creating a custom event.

            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