You are viewing our Forum Archives. To view or take place in current topics click here.
Quick C# Question +50rep
Posted:
Quick C# Question +50repPosted:
Status: Offline
Joined: Jul 30, 201212Year Member
Posts: 2,396
Reputation Power: 123
Status: Offline
Joined: Jul 30, 201212Year Member
Posts: 2,396
Reputation Power: 123
I have a project that uses a main form to open other forms for different games. When a new form opens, the original form is closed. I'm trying to set it up to open a messagebox when you close the new form, asking to restart the program or close it completely. I've got the coding looking correct, but every time I try to debug the program won't open at all.
at the top I have
a little further down, right after defining XRPC
Then this
All of it seems fine and not giving any errors, but when I try to debug the program just will not open :/ Whoever can help me get this working will be sent +50 rep
at the top I have
using Wildfire0;
a little further down, right after defining XRPC
Wildfire wildfire = new Wildfire();
Then this
private void Skyrim_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult dlgresult = MessageBox.Show("Would you like to restart the program? Click Yes to restart Wildfire, click No to close it completely.", "Wildfire", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (dlgresult == DialogResult.Yes)
{
wildfire.ShowDialog();
}
else
{
Application.Exit();
}
}
All of it seems fine and not giving any errors, but when I try to debug the program just will not open :/ Whoever can help me get this working will be sent +50 rep
#2. Posted:
Status: Offline
Joined: Aug 24, 201311Year Member
Posts: 355
Reputation Power: 14
Status: Offline
Joined: Aug 24, 201311Year Member
Posts: 355
Reputation Power: 14
everything looks okay to me except for
private void Skyrim_FormClosing(object sender, FormClosingEventArgs e)
try messing with this line of code a bit
private void Skyrim_FormClosing(object sender, FormClosingEventArgs e)
try messing with this line of code a bit
- 0useful
- 0not useful
#3. Posted:
Status: Offline
Joined: Jun 08, 201410Year Member
Posts: 9
Reputation Power: 2
Perhaps on the loading process of the 2nd forum, you should close the first one?
Just add this before the constructor
Just add this before the constructor
Load += new EventHandler(Form2_Load);
void Form2_Load(object a, EventArgs e)
{
using (Form1 form = new Form1())
{
form.Close();
}
}
- 1useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.