Tuesday, October 13, 2009

How to Dispose a Form in C# Without Closing the Application

in program.cs file replace the following code

      Application.Run(new Form1());

with, an instance of your start-up form, such as

   Form1 frm1 = new Form1();
   frm1.Show();
   Application.Run();
*** now you can dispose the form without closing the application
-------------------------------------

from time to time, you will be needing these codes:

   Application.Exit(); <- to close the whole application

   frm1.Close(); <- to close your current form window
   frm1.Dispose(); <- to free memory resources, when form is shown modally. ^_^
-------------------------------------
***good luck***

7 comments:

  1. cha..grabe nakalimot najud ko anang mga codes. grabe... :(

    ReplyDelete
  2. hi ye! lage..maning-tiil na jud ni ba! ^_^
    oks ra na ye! dli man pud kani imo gipili na work.hehehe.stress na kau ako student...pati pud ako!.hehehe.kay ngano ngteacher!

    ReplyDelete
  3. Heya i'm for the first time here. I found this board and I find It really useful & it helped me out much. I hope to give something back and aid others like you helped me.

    my site - view

    ReplyDelete
  4. I am regular reader, how are you everybody? This piece of writing posted at this web site is in fact good.


    my website: v2 cigs 15 off coupon code

    ReplyDelete
  5. Why visitors still make use of to read news papers when in this technological globe
    the whole thing is presented on net?

    Here is my webpage; info

    ReplyDelete
  6. Sugar Sync offers a lot of the competition, it delivers a fleshlight solid mid-pack performance.
    Rnd 6: This rnd starts body: 2 sc in the chain 2 space, work sc in each sc around, join in first sl
    st, leaving a sewing length, fasten off. Palms are actually long -living
    plants that may bloom as much as he can, regardless whether it's short term or long term deal.

    ReplyDelete
  7. Howdy very cool site!! Guy .. Excellent .. Superb .
    . I will bookmark your site and take the feeds additionally?
    I'm satisfied to find so many helpful information here in the publish, we'd like work out
    extra strategies in this regard, thank you for sharing.
    . . . . .

    ReplyDelete