A question of form ;)
-
Hi! A little puzzle... You create a C# Windows Forms project. You name your form 'frmClient'. You add another form (with right click in solution explorer) and name it 'frmClientDetails'. The user, when using the 'frmClient', press the button 'btnClientDetails'. This button close 'frmClient' and instanciate 'frmClientDetails', to let the user fiddle with the clients details. The question I have, is what is the code to provide this functionnality? In VB6 (god forgive me) it was simple ... Unload frmClient frmClientDetails.show In C#, It obviously a most erronous approach... Ok, I know its kinda simple, I'm sure, but please, help me out in this simple problem! :) Thanks! Orlanda
-
Hi! A little puzzle... You create a C# Windows Forms project. You name your form 'frmClient'. You add another form (with right click in solution explorer) and name it 'frmClientDetails'. The user, when using the 'frmClient', press the button 'btnClientDetails'. This button close 'frmClient' and instanciate 'frmClientDetails', to let the user fiddle with the clients details. The question I have, is what is the code to provide this functionnality? In VB6 (god forgive me) it was simple ... Unload frmClient frmClientDetails.show In C#, It obviously a most erronous approach... Ok, I know its kinda simple, I'm sure, but please, help me out in this simple problem! :) Thanks! Orlanda
im not quiet sure what you are shooting for... but if the components on your second form are already intialized i.e MyRichTextBox = new RichTectBox(); try FormClient.Hide(); FormClientDetails.Show(); this will keep the form loaded and just simply hide it from the user ... Jesse M
-
im not quiet sure what you are shooting for... but if the components on your second form are already intialized i.e MyRichTextBox = new RichTectBox(); try FormClient.Hide(); FormClientDetails.Show(); this will keep the form loaded and just simply hide it from the user ... Jesse M
Hi ! How do I know if the components on the second are initialized ? thanks! :):);) Orlanda
-
Hi ! How do I know if the components on the second are initialized ? thanks! :):);) Orlanda
the formxxx.Handle property is not null
-
im not quiet sure what you are shooting for... but if the components on your second form are already intialized i.e MyRichTextBox = new RichTectBox(); try FormClient.Hide(); FormClientDetails.Show(); this will keep the form loaded and just simply hide it from the user ... Jesse M
Here is the code, Jessy, for my main form, the one that was created with the project, and the one that loads first. using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace PersonnaInterfaceSystem { /// /// Summary description for frmPISmain. /// public class frmPISmain : System.Windows.Forms.Form { private System.Windows.Forms.PictureBox pictureBox6; private System.Windows.Forms.PictureBox picLogo; private System.Windows.Forms.Button btnQuit; private System.Windows.Forms.PictureBox pictureBox9; private System.Windows.Forms.PictureBox picContacts; private System.Windows.Forms.PictureBox picPersonnaliser; private System.Windows.Forms.PictureBox picCommunauté; private System.Windows.Forms.PictureBox picCourrier; private System.Windows.Forms.PictureBox picHoraire; private System.Windows.Forms.PictureBox picSmithers; private System.Windows.Forms.PictureBox picErendering; private System.Windows.Forms.Button btn; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public frmPISmain() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { hiden (too BIG!) } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new frmPISmain()); } private void btnQuit_Click(object sender, System.EventArgs e) { Application.Exit(); } private void btn_Click(object sender, System.EventArgs e) { frmPISmain.ActiveForm.Hide(); frmPISContact.ActiveForm.Show(); } } } Heres the error I get!: ************************ An unhandled exception of type 'System.NullReferenceException' occurre
-
Here is the code, Jessy, for my main form, the one that was created with the project, and the one that loads first. using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace PersonnaInterfaceSystem { /// /// Summary description for frmPISmain. /// public class frmPISmain : System.Windows.Forms.Form { private System.Windows.Forms.PictureBox pictureBox6; private System.Windows.Forms.PictureBox picLogo; private System.Windows.Forms.Button btnQuit; private System.Windows.Forms.PictureBox pictureBox9; private System.Windows.Forms.PictureBox picContacts; private System.Windows.Forms.PictureBox picPersonnaliser; private System.Windows.Forms.PictureBox picCommunauté; private System.Windows.Forms.PictureBox picCourrier; private System.Windows.Forms.PictureBox picHoraire; private System.Windows.Forms.PictureBox picSmithers; private System.Windows.Forms.PictureBox picErendering; private System.Windows.Forms.Button btn; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public frmPISmain() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { hiden (too BIG!) } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new frmPISmain()); } private void btnQuit_Click(object sender, System.EventArgs e) { Application.Exit(); } private void btn_Click(object sender, System.EventArgs e) { frmPISmain.ActiveForm.Hide(); frmPISContact.ActiveForm.Show(); } } } Heres the error I get!: ************************ An unhandled exception of type 'System.NullReferenceException' occurre
Anonymous wrote: frmPISmain.ActiveForm.Hide(); frmPISContact.ActiveForm.Show(); the following would be better :
frmPISmain.Hide();
frmPISContact childForm = new frmPISContact();
childForm.Show();