|
Thanks it worked the way I wanted it to be.
|
|
|
|
|
Make sure you close the menu form as well when you are closing the second form. You can access that using Application.OpenForms collection.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
where are you calling your initial frmMenu form from? I think your problem is you are creating frm2Players from within frmMenu which means when that closes it will close all children.
What you want to do is call frmMenu from wherever it is you call that now, and have that return a value (suggested through a property), when btn2Player is clicked then the property is set and the frmMenu is closed - the parent form/class can then use that property to determine what form to open next.
something like...
if(frmMenu.ShowDialog == DialogResult.OK)
{
switch(frmMenu.OptionProperty)
{
case 1:
frm1Player frm1P = new frm1Player();
frm1P.Show();
break;
case 2:
frm2Players frm2P = new frm2Players();
frm2P.Show();
break;
}
}
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
where are you calling your initial frmMenu form from?
I think your problem is you are creating frm2Players from within frmMenu which means when that closes it will close all children.
Yup. That is what happens when I tried to execute the .Close() method. I tried d@nish 's method and it worked the way I wanted it to be. Thanks anyway
|
|
|
|
|
No problem, but may I say that the apparent quick fix you have chosen may not be the best option. Will you need to display the frmMenu again at any point?
Out of interest, I assume you are making a game or some sort? any particular reason to use windows forms?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Application.OpenForms collection would help out then.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Yeah maybe, I think it depends on the usage of the menu form, if its a 'main menu' kind of form then it should be re-opened when the game form is done, unless a complete quit selection of some sort is made...
though, you could of course use your method to show the menu form again. I guess it's just preference at the minute (maybe i'll think of a good reason either way later )
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Erm.. where should I put the
Application.OpenForms[0].Show(); code ? I cant find an event handler that triggers when you closes a form.
|
|
|
|
|
Yup Its a tic-tac-toe. I am using labels for the "O" and "X". But. I think I will use MDI instead because I could not figure out where to put the
frmMenu.Show(); code to show the menu form once i close the game form (I could not find any event handler that triggers when you close the form).
EDIT:
Application.OpenForms collection would help out then. oh wait ...
modified on Monday, September 14, 2009 7:26 PM
|
|
|
|
|
There is a Form_Closing event. You can make use of that.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
|
Hi,
you can't close it.
because 'frm2players' is one child form of the 'frmMenu';
Give you two :
1) hide the 'frmMenu'; use 'frmMenu.visible = false;' or 'frmMenu.Hide();'
2) Create one Thread to create 'frm2Players';
/********************/
'Thread td = new thread(method);' // method is 'create frm2player'
td.start();
/********************/
note: thread is 'light', so can't have Resources as 'Main thread'.
modified on Tuesday, September 22, 2009 2:13 AM
modified 27-May-14 5:36am.
|
|
|
|
|
you can't close it.
because 'frm2players' is one child form of the 'frmMenu';
Give you two :
1) hide the 'frmMenu'; use 'frmMenu.visible = false;' or 'frmMenu.Hide();'
2) Create one Thread to create 'frm2Players';
/********************/
'Thread td = new thread(method);' // method is 'create frm2player'
td.start();
/********************/
note: thread is 'light', so can't have Resources as 'Main thread'.
modified 27-May-14 5:32am.
|
|
|
|
|
Hi,
How I can create Automation object in c#?
Thanks in Advance..
|
|
|
|
|
|
Hello,
I'm developing a desktop application that sends sms messages,I'm trying to send a midi file ring tone to a NOKIA phone but I don't know how to format it to be acceptable for NOKIA phones.First, I've read the file for a byte[] then I've converted it to a hex string but it does not work!
How can I convert the binary midi file to a format acceptable to NOKIA phones?
Thanks
Dad
|
|
|
|
|
Depends on the Nokia model, most phones accept MP3 in today's models.
|
|
|
|
|
Depends on the handset. The one I use supports avi, mp3 and may be more.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
hi all,
i am generating an office word 2007 document using C# in windows application, then saving the word document in the xml format in my local system.
Here my requirement is using that xml file and one predefined xsl file i need to generate one xslt,while doing this process i am getting the error like the "document is already being used by the another process."
any one please help on this...it is urgent for me
Regards,
Haneef
|
|
|
|
|
Shaik Haneef wrote: t is urgent for me
Well, I'm afraid you're all out of luck. A basic understanding of computers will tell you that the reason you get this error, is that you can't access a file being used by another process. Your only option really, if you MUST have access, is to find out the process that's locking it ( that would be Word, from the sound of it ), and kill it. I am sure that's not the result you're looking for.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
0) The app that's creating the file would need to allow concurrent reads.
1) But with XML, having access to only a partial document is useless.
2) Ergo, the creating app would need to write the entire file before the reading app reads it, so the creating app might as well close the file and exit before the reading app runs.
Some of what you wrote (e.g. "one predefined xsl file i need to generate one xslt") is gibberish.
|
|
|
|
|
I try to include the publish button in my project how can i code for it i do not have any idea about it how to start
|
|
|
|
|
santosh_anu wrote: I try to include the publish button in my project how can i code for it i do not have any idea about it how to start
Use the FormDesign window and toolbox. Drag a button from the toolbox onto the form and adjust the properties as required.
|
|
|
|
|
Hi all,
I have seen a solution,which deals with File download in web browser.
and the bellow code gives error
can some one help me what is the problem here...
Thread workThread = new Thread(delegate()
{
FindDownloadDialogWindow("#32770", "File Download", 120,
});
From here i tried download dialogue
thanks
|
|
|
|
|