Hello,
I try from one form by clicking the button to open another form. I put this code, but nothing happens:
private void button1_Click(object sender, EventArgs e)
{
Izvest frm = new Izvest();
frm.Show();
}
Can anybody tell me please where is my error.
The second form's name is Izvest.
Thanks.
Loading

VulpesRank #55 · 29.2K reputationPosted Aug 11, 2011, 1:32 AM EDT
Om prakash Singh126 reputationPosted Aug 10, 2011, 2:25 AM EDT
Private void button1_Click(object sender, EventArgs e)
{
Izvest frm = new Izvest();
frm.Activate();
frm.BringToFront();
frm.Show();
}
Priya LingeRank #785 · 2.9K reputationPosted Aug 10, 2011, 2:31 AM EDT
I did samething ,Second form open by button click.
private void button1_Click(object sender, EventArgs e)
{
Form2 fr = new Form2();
fr.Show();
}
Please see attached file.
Hope this will help you.
Thanks.
NelRank #2,060 · 702 reputationPosted Aug 10, 2011, 3:00 AM EDT
Priya: I saw the code, but the code I need is the same like mine.
I still have the problem
Om prakash Singh126 reputationPosted Aug 10, 2011, 3:06 AM EDT
If you can please send me the code of second page.
NelRank #2,060 · 702 reputationPosted Aug 10, 2011, 3:25 AM EDT
public partial class Izvest : Form
{
public Izvest()
{
InitializeComponent();
}
}
VulpesRank #55 · 29.2K reputationPosted Aug 10, 2011, 4:58 AM EDT
Izvest frm = new Izvest();
frm.ShowDialog(this);
Sam HobbsRank #107 · 20.5K reputationPosted Aug 10, 2011, 3:30 PM EDT
Do you know how to use the debugger? You should put a breakpoint in the constructor for Izvest, then debug the program. Do you know what I mean by "constructor"? You can put a breakpoint in the constructor (such as the line that calls InitializeComponent()) by going to (putting the cursor in) that line and pressing F9. A red ball will appear in the left margin. Then press F5. If, when you click the button the debugger stops at the breakpoint then that gives us a big clue. If it does, then just press F5 a second time, close the program and post a reply here telling us that it did that. If the debugger does not stop at the breakpoint then post a reply here telling us that it did not.
NelRank #2,060 · 702 reputationPosted Aug 10, 2011, 10:06 PM EDT
At Izvest.cs, line 17 character 13 ('Bl_jt.Izvest.Izvest()',line 3)
The brakepoint will not currently be hit. No symbols have been loaded for this document.
NelRank #2,060 · 702 reputationPosted Aug 10, 2011, 10:10 PM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Aug 10, 2011, 10:42 PM EDT
Try this. First put a MessageBox at the end (after the frm.Show()) of the button1_Click method. Then put a breakpoint on the first line (Izvest frm = new Izvest()) of the button1_Click method and then debug with that. Assuming that the breakpoint is hit, press F5 when it is hit. After that, you should see the MessageBox. Let us know what happens from that.
NelRank #2,060 · 702 reputationPosted Aug 11, 2011, 10:26 PM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Aug 12, 2011, 9:11 AM EDT
NelRank #2,060 · 702 reputationPosted Aug 12, 2011, 10:12 AM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Aug 12, 2011, 3:31 PM EDT