Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. A question of form ;)

A question of form ;)

Scheduled Pinned Locked Moved C#
questionhelpcsharpwinforms
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    antoine orchus tech
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • A antoine orchus tech

      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

      J Offline
      J Offline
      jtmtv18
      wrote on last edited by
      #2

      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

      A A 2 Replies Last reply
      0
      • J jtmtv18

        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

        A Offline
        A Offline
        antoine orchus tech
        wrote on last edited by
        #3

        Hi ! How do I know if the components on the second are initialized ? thanks! :):);) Orlanda

        S 1 Reply Last reply
        0
        • A antoine orchus tech

          Hi ! How do I know if the components on the second are initialized ? thanks! :):);) Orlanda

          S Offline
          S Offline
          Stephane Rodriguez
          wrote on last edited by
          #4

          the formxxx.Handle property is not null

          1 Reply Last reply
          0
          • J jtmtv18

            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

            A Offline
            A Offline
            Anonymous
            wrote on last edited by
            #5

            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

            S 1 Reply Last reply
            0
            • A Anonymous

              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

              S Offline
              S Offline
              Stephane Rodriguez
              wrote on last edited by
              #6

              Anonymous wrote: frmPISmain.ActiveForm.Hide(); frmPISContact.ActiveForm.Show(); the following would be better :

              frmPISmain.Hide();

              frmPISContact childForm = new frmPISContact();
              childForm.Show();

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups