Newbie code problem please help?
-
Hi, I am writing a program in C#, and I want a customize form to pop up. I created the new form and set it up as a new item (Form frmCustomize = new Form();). So then, in my code, I put this code in for when they click on Customize, and the form shows, but none of the controls are there, any reasons why, or any help? The code: // When they click 'Customize' from the help menu the Customize form shows private void customizeToolStripMenuItem_Cli... sender, EventArgs e) { // Show the customize form frmCustomize.Show(); }
-
Hi, I am writing a program in C#, and I want a customize form to pop up. I created the new form and set it up as a new item (Form frmCustomize = new Form();). So then, in my code, I put this code in for when they click on Customize, and the form shows, but none of the controls are there, any reasons why, or any help? The code: // When they click 'Customize' from the help menu the Customize form shows private void customizeToolStripMenuItem_Cli... sender, EventArgs e) { // Show the customize form frmCustomize.Show(); }
Wolf92 wrote:
Form frmCustomize = new Form()
This creates an instance of the base class Form, not the form you created. You have to do something like this:
private Form customiseForm = new CustomiseForm();
Note: I've assumed your customise form class is called
CustomiseForm
. I've also assumed that you expose no new public functionality. If you do (and it most likely is that you do) then you may wish to declare the customiseForm field as aCustomiseForm
rather than a simpleForm
. Does this help?
Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos
-
Hi, I am writing a program in C#, and I want a customize form to pop up. I created the new form and set it up as a new item (Form frmCustomize = new Form();). So then, in my code, I put this code in for when they click on Customize, and the form shows, but none of the controls are there, any reasons why, or any help? The code: // When they click 'Customize' from the help menu the Customize form shows private void customizeToolStripMenuItem_Cli... sender, EventArgs e) { // Show the customize form frmCustomize.Show(); }