none
how to close C# form

    Question

  • Hi

    I am working in visual studio C# 2005.

    I have written a client socket program. After closing the client connection. I want to shutdown the form.

    In VB if you put down "end" the form closes and so does the program.

    But when i put down form.close();

    the 'close' does not come in popup menu at all.

     

    where am i going wrong

    regards

    skrcmr

    Friday, August 17, 2007 6:20 AM

Answers

  • I guess you could try 

     

    this.Close()  or  Application.Exit()

     

    this.Close() should be what you wanted.

    Friday, August 17, 2007 7:09 AM

All replies

  • You wanted to place a confirmation for the form close I guess..sorry if i misunderstood your question.

     

    check this for prompt the user to confirm the closing

     

    Friday, August 17, 2007 6:55 AM
  • use

    this.Close();


    Friday, August 17, 2007 7:06 AM
  • I guess you could try 

     

    this.Close()  or  Application.Exit()

     

    this.Close() should be what you wanted.

    Friday, August 17, 2007 7:09 AM
  • hi, how are you guys ? every thing is fine ?

    I am working on Sockets on both Server and clients sides,

    so, I think the best thing to do for this situation is to do the following:

    1 - It would best to make a confirmation message box for closing.

    2 - shutdown all the Sockets the you initialized before closing the application.

    3 - Finally, just close the application.

    notice that step 2 is the most important in this process, since that if you didn't shutdown the Socket it most of the time couse the application to not response.

    hope this helps.
    Tuesday, November 25, 2008 8:58 AM