|
i have a tow server one of theme i set the main database and the ather i set the the application the target of the application is to get data from 50 site to main database i can't change this structure
i want to use syncronization service to sync data between main db and 50 site can syncronization service help
|
|
|
|
|
I suggest you post than in the General Databases forum.
|
|
|
|
|
Hi guys,I have a program that starts with a menu form. It will create a new form and remove the menu form after the user pressed a certain button. So I tried the following method :
private void btn2Player_Click(object sender, EventArgs e)
{
frmMenu frmMenu = new frmMenu();
frm2Players frm2P = new frm2Players();
frm2P.Show();
frmMenu.Close();
}
The new form that it is supposed to create shows up but strangely the menu form is still there. What should I do ?
|
|
|
|
|
frmMenu is a new object, you never showed it, so it never closed.
If you want to close the current form you can do the following...
private void btn2Player_Click(object sender, EventArgs e)
{
frm2Players frm2P = new frm2Players();
frm2P.Show();
this.Close();
}
|
|
|
|
|
The menu form did closed but it seems that if the menu form is closed, the new form is closed together with it ... hmm maybe I should try MDI ?
|
|
|
|
|
If I have understood your problem correctly, btn2Player is a Button on your menu form. Would you confirm that that is correct.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Yes. btn2Player calls a new form and after calling the new form, it will remove the old one (menu form)
|
|
|
|
|
As ElliotA has said you are creating a new menu form and closing that, rather than the original one as you intend.
To do what you want, change your code to something like:
private void btn2Player_Click(object sender, EventArgs e)
{
frm2Players frm2P = new frm2Players();
frm2P.Show();
this.Close();
}
However, you said that the menu form is the first form in your application, so if you close it, you will close your whole application, including the new frm2Players that you have just created.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Lim Yuxuan wrote: frmMenu frmMenu = new frmMenu();// menu form
Remove this line since it is not the current instance of menu form.
Lim Yuxuan wrote: frmMenu.Close();//Close the menu form
Replace this line by: this.Hide();
Do not use this.Close() since it will also dispose object frm2P and second form would be closed as well.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
modified on Monday, September 14, 2009 10:07 AM
|
|
|
|
|
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
|
|
|
|