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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. setting new interval value and turning on timer in Parent Form

setting new interval value and turning on timer in Parent Form

Scheduled Pinned Locked Moved C#
xmlhelpannouncement
2 Posts 2 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.
  • E Offline
    E Offline
    emran834
    wrote on last edited by
    #1

    Hello, I have a Win Form name Settings where user can inout int value and save. And this form is a child form of the MainForm. now, I want that, whenever user enters new value in the child form and click Save Button, The MainForm should read the new saved XML (created by child) and turn a timer on with new interval. I tried the following code, MainForm myParent = this.Owner as MainForm ; myParent.updateTimer(); // updateTimer is a public method in MainForm who read the XML file and update accordingly. Now, i get an error message, "Object refrence is not set to an instance of an object." I am wondering that, the same piece of code is working some other place and its not working some place. (Even in the same file. ) Can you give me any clue please. thanks.

    R 1 Reply Last reply
    0
    • E emran834

      Hello, I have a Win Form name Settings where user can inout int value and save. And this form is a child form of the MainForm. now, I want that, whenever user enters new value in the child form and click Save Button, The MainForm should read the new saved XML (created by child) and turn a timer on with new interval. I tried the following code, MainForm myParent = this.Owner as MainForm ; myParent.updateTimer(); // updateTimer is a public method in MainForm who read the XML file and update accordingly. Now, i get an error message, "Object refrence is not set to an instance of an object." I am wondering that, the same piece of code is working some other place and its not working some place. (Even in the same file. ) Can you give me any clue please. thanks.

      R Offline
      R Offline
      Robin Panther
      wrote on last edited by
      #2

      I'm pretty sure that "this.Owner" is null on this step. Either you forgot to set Owner property of your child form, either you show child form through ShowDialog function without argument. Check this out first. ____________________________________________ Robin Panther http://www.robinland.com

      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