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. accessing properties of the mdiParent from the child

accessing properties of the mdiParent from the child

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

    here is what I have: //the property for the parent form in the child form private frmMain ParentForm { get{return (frmMain)this.MdiParent;} } //the load form method private void frmEventList_Load(object sender, System.EventArgs e) { //set the form status ParentForm.StatusBar = "Searching for events"; //StatusBar is a property in the frmMain that sets the status bar LookupEvents(DateTime.Now, DateTime.Now); ParentForm.StatusBar = "Ready222"; } using this the Parent forms status bar text does not change. No exception is thrown indiciating that there is somthing wrong with the code. I have just recently had to change over from VB.NEt so it may be something simple. Thanks for the help

    S 1 Reply Last reply
    0
    • K kowplunk

      here is what I have: //the property for the parent form in the child form private frmMain ParentForm { get{return (frmMain)this.MdiParent;} } //the load form method private void frmEventList_Load(object sender, System.EventArgs e) { //set the form status ParentForm.StatusBar = "Searching for events"; //StatusBar is a property in the frmMain that sets the status bar LookupEvents(DateTime.Now, DateTime.Now); ParentForm.StatusBar = "Ready222"; } using this the Parent forms status bar text does not change. No exception is thrown indiciating that there is somthing wrong with the code. I have just recently had to change over from VB.NEt so it may be something simple. Thanks for the help

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

      are u sure ur frmEventList_Load is getting callled? Try putting a break point in the event handler and following ur code. U should see where ur code is failing to do what u expect. What u've posted looks fine but we're missing a lot more that could be wrong.

      K 1 Reply Last reply
      0
      • S Skynyrd

        are u sure ur frmEventList_Load is getting callled? Try putting a break point in the event handler and following ur code. U should see where ur code is failing to do what u expect. What u've posted looks fine but we're missing a lot more that could be wrong.

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

        I have put the line break in the load event. It steps through fine, but when I call on the StatusBar property in the commend window it says: error: 'ParentForm.StatusBar' does not exist but how would the parent mdiForm not exist? Thanks for the help.

        A 1 Reply Last reply
        0
        • K kowplunk

          I have put the line break in the load event. It steps through fine, but when I call on the StatusBar property in the commend window it says: error: 'ParentForm.StatusBar' does not exist but how would the parent mdiForm not exist? Thanks for the help.

          A Offline
          A Offline
          Anonymous
          wrote on last edited by
          #4

          Could you please post the code where u are creating and showing the MdiChild?

          K 1 Reply Last reply
          0
          • A Anonymous

            Could you please post the code where u are creating and showing the MdiChild?

            K Offline
            K Offline
            kowplunk
            wrote on last edited by
            #5

            Here is the form load for the mdiParent private void frmMain_Load(object sender, System.EventArgs e) { //populate the status bar StatusBarPanel status = new StatusBarPanel(); //status.Text = "Ready"; status.AutoSize = StatusBarPanelAutoSize.Spring; sbrStatus.Panels.Add(status); sbrStatus.ShowPanels = true; //attach the child window Form frmEventList = new frmEventList(); frmEventList.MdiParent = this; frmEventList.WindowState = System.Windows.Forms.FormWindowState.Maximized; frmEventList.Show(); } Thanks for the help

            S 1 Reply Last reply
            0
            • K kowplunk

              Here is the form load for the mdiParent private void frmMain_Load(object sender, System.EventArgs e) { //populate the status bar StatusBarPanel status = new StatusBarPanel(); //status.Text = "Ready"; status.AutoSize = StatusBarPanelAutoSize.Spring; sbrStatus.Panels.Add(status); sbrStatus.ShowPanels = true; //attach the child window Form frmEventList = new frmEventList(); frmEventList.MdiParent = this; frmEventList.WindowState = System.Windows.Forms.FormWindowState.Maximized; frmEventList.Show(); } Thanks for the help

              S Offline
              S Offline
              Skynyrd
              wrote on last edited by
              #6

              I cant see what is wrong with ur code...at least not to the point where the command line would give u the error ur stating, unless ur querying ParentForm.StatusBar when its out of scope although I doubt that. Whats even wierder is that, if I'm not misunderstanding, when ur application runs, your not getting any exception. Just to cover all possibilities, I'll ask u to post some more code once again...sorry :p : Please post ur StatusBar property.

              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