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. Close Child Form

Close Child Form

Scheduled Pinned Locked Moved C#
helpquestiondebugging
4 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.
  • T Offline
    T Offline
    Tyler45
    wrote on last edited by
    #1

    how can i close child form? debugger gives this error : An unhandled exception of type 'System.NullReferenceException' occurred in market.exe Additional information: Object reference not set to an instance of an object. and i use it this line for closing: this.ActiveMdiChild.Close(); pleae help me Thanks

    C D 2 Replies Last reply
    0
    • T Tyler45

      how can i close child form? debugger gives this error : An unhandled exception of type 'System.NullReferenceException' occurred in market.exe Additional information: Object reference not set to an instance of an object. and i use it this line for closing: this.ActiveMdiChild.Close(); pleae help me Thanks

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

      And what does the call stack show? Where is this null reference occurring? What is null that wasn't expected to be null? You need to find that point, then set a break point in the debugger just before that happens to see why you are getting a null.


      My: Blog | Photos "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious

      1 Reply Last reply
      0
      • T Tyler45

        how can i close child form? debugger gives this error : An unhandled exception of type 'System.NullReferenceException' occurred in market.exe Additional information: Object reference not set to an instance of an object. and i use it this line for closing: this.ActiveMdiChild.Close(); pleae help me Thanks

        D Offline
        D Offline
        da vinci coder
        wrote on last edited by
        #3

        lets say the form name which has MdiChild u want to close is market: market.ActiveForm.ActiveMdiChild.Close(); i`m not sure if it works maybe u can give more detailts about the code

        T 1 Reply Last reply
        0
        • D da vinci coder

          lets say the form name which has MdiChild u want to close is market: market.ActiveForm.ActiveMdiChild.Close(); i`m not sure if it works maybe u can give more detailts about the code

          T Offline
          T Offline
          Tyler45
          wrote on last edited by
          #4

          thanks for your help but i thought wrong simply it closes like a other form e.g. this.close(); or just close(); thanks again

          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