8 Replies - 811 Views - Last Post: 22 September 2011 - 05:47 PM Rate Topic: -----

#1 coder_d   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 21-August 11

Problem in closing the window in the program

Posted 21 September 2011 - 07:57 PM

i am open a new project and then added a button, and then wrote this code inside the button

Form2 editForm = new Form2();                                                   
editForm.ShowDialog();  


on Clicking this button will show a window number 2 ,
In this window button to get out of the window No. 2 and inserted this code
  Application.Exit();




This code to close the window No. 2, but the problem is that the main window also closed

i want to make a code so that the closure of the window No. 2 and does not close the window No. 1

Is This A Good Question/Topic? 0
  • +

Replies To: Problem in closing the window in the program

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14175
  • View blog
  • Posts: 56,780
  • Joined: 12-June 08

Re: Problem in closing the window in the program

Posted 21 September 2011 - 08:47 PM

Well yes, as the function says "application exits"! How about a simple "Close();" instead?

http://msdn.microsof...=VS.100%29.aspx

http://msdn.microsof...form.close.aspx
Was This Post Helpful? 2
  • +
  • -

#3 coder_d   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 21-August 11

Re: Problem in closing the window in the program

Posted 21 September 2011 - 10:26 PM

thank you very mach
your code is very good

This post has been edited by coder_d: 21 September 2011 - 10:26 PM

Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6535
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: Problem in closing the window in the program

Posted 22 September 2011 - 06:17 AM

Would you be trying to write a song after your 3rd lesson of learning the notes, before learning anything about chords or timing?

For now, just work on the lessons. Do a self-teaching book from cover to cover. Then consider writing a program.

Don't try to create a useful working program to fit a need of yours (or a for-pay contract) as your introduction to coding project. When you are learning to code you don't know enough to code a program, let alone know how to engineer the architecture of a program. It would be like saying "I don't know how to read sheet music, or play an instrument. I think I'll write a 3act opera as my first learning experience."

I don't say this to be mean. We've seen lots of new coders take this approach and we know it doesn't work. Trying to design your own programs before you understand the basics of the code language you've chosen just leads to problems, frustrations, and 'swiss-cheese' education (lots of holes).


Resources, references and suggestions for new programmers. - Updated Sep 2011
Spoiler

Was This Post Helpful? 0
  • +
  • -

#5 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6535
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: Problem in closing the window in the program

Posted 22 September 2011 - 06:35 AM

[HR}

Coder_d
In the future please do not write experts in PM asking for their attention on the threads you just posted. Its rather presumptuous and demanding. Not to mention your thread had only but up a few hours when modi123_1 provided a response.

This is not a pay for assistance site. Everyone here volunteers. Writing me or anyone else in the middle of the night while they are sleeping does you no good. When they get on DIC and see your message they would also be notified of all the new posts. If it is something they can and want to take a look at they will.



There are many different kinds of nebiew posters on DIC.

By far the majority of newbies are people asking for code that solves their needs/homework. It doesn't seem to matter to these people that DIC has posted all over the place "We won't do you homework" and "You need to provide your good faith effort to code a solution to your problem." These people have already demonstrated with their first post a complete disrespect for the site rules and by extension the people on the site. They have also demonstrated their view of the volunteers here as being their personal code generation servants. Since these people have already insulted everyone on DIC with their arrogance it is not surprising that I or anyone else respond in the same manner in which they started their topic.

Next come the people that aren't exactly looking for a complete code dump of the solution. These are the people that are just too lazy to google and experiment and do tutorials or too lazy to learn before trying. They just start typing and *think* they know what a function should do based on nothing more than the name of the function. Then when it doesn't work as expected they declare it broken and ask for help to get around the *problem*, without every trying to look it up on MSDN or crack open a book. This doesn't disrespect the site, but it does disrespect the volunteers by reducing them to the OP's research slaves. Again, it's not unreasonable to expect a volunteer to respond with a tone of "I'm not your goggle-bot. Try looking it up and following the example."

Next comes the rare person who has made an effort. This highly prized newbie is working through a book or on-line tutorial... get's stuck {usually on something poorly documented}... takes it upon themselves to research... does their own trial and error... But still can't get an answer so they are left with having to ask for help. In my book these are the only type of people that will ever amount to anything in the coding world (but that is personal opinion). This rare third type of newbie is someone that we all like to see, want to see more of, and we do our best to give as much attention and patience as we can muster. Can I get a 'Hell ya!' ?

It should also be considered that being frank and honest with someone is not the same as being rude. Just because a volunteer doesn't blow rainbows and sunshine up someone's skirt doesn't mean they are rude. Honestly advising a student they lack any amount of understanding on a topic, and they need to seek out the teacher or tutor is not rude. It is frank honesty, aimed at convincing them to seek help so they don't become further lost and waste more time and money while loosing out on an education.

As frank as I have been with a lot of newbies, I don't think you could find an instance where even *I* have called someone stupid. Lazy perhaps. But it is not in my nature to call someone stupid. I know I have suggested (more than once even) that someone might not be equipped for programming as a profession. Some people might think that rude. That may not be what someone wants to hear. But it could be what they *need* to hear. Some people really don't have what it takes. I would not be a good airline pilot or food server: I'd kill someone by the end of a day at food service. Some people are not equipped to be cops, or air traffic tower controllers. Should those people receive nothing but encouraging but polite lies? I think not. At some time all people have to grow up and accept frank honesty and a realistic self-image of their capabilities.


Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14175
  • View blog
  • Posts: 56,780
  • Joined: 12-June 08

Re: Problem in closing the window in the program

Posted 22 September 2011 - 06:42 AM

What did the OP send you? More questions on his app?
Was This Post Helpful? 0
  • +
  • -

#7 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6535
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: Problem in closing the window in the program

Posted 22 September 2011 - 04:03 PM

Apparently this guy thinks we're related and I give preferential attention to people who go out of their way to bug me.

Attached Image
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14175
  • View blog
  • Posts: 56,780
  • Joined: 12-June 08

Re: Problem in closing the window in the program

Posted 22 September 2011 - 05:30 PM

Awww.. he just wants to be friends! With the benefit of you writing his code! Hahaha.. I kid.. I kid.
Was This Post Helpful? 0
  • +
  • -

#9 coder_d   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 21-August 11

Re: Problem in closing the window in the program

Posted 22 September 2011 - 05:47 PM

I would like to thank the people who speak with respect
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1