Form disappearing
-
Thanks OriginalGriff Apologies, should have made my description clearer, the form never actually appears (or if it does then it quickly disappears), it is the only form currently and I am not entering / selecting anything (I don't get the chance). Any thoughts appreciated. Regards Active
So what code are you displaying it with?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
So what code are you displaying it with?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
I had expected that the following should make the form appear -
private void frmConfiguration_Load(object sender, System.EventArgs e)
{
}private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.btnok = new System.Windows.Forms.Button();etc ... Regards Active
-
I had expected that the following should make the form appear -
private void frmConfiguration_Load(object sender, System.EventArgs e)
{
}private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.btnok = new System.Windows.Forms.Button();etc ... Regards Active
:laugh: No - what code makes the form display? Are you creating it in Main (in process.cs)? Or do you display it from an existing form?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
:laugh: No - what code makes the form display? Are you creating it in Main (in process.cs)? Or do you display it from an existing form?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Thanks, I was missing the .Run in main, thought it was something silly. The form now appears but it is blank (no text, fields etc displaying), probably something else missing. Regards Active
-
Thanks, I was missing the .Run in main, thought it was something silly. The form now appears but it is blank (no text, fields etc displaying), probably something else missing. Regards Active
I don't see any form constructor in your code? So what is calling InitializeComponent - if you don't call that in a constructor, then there will be nothing to show!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Thanks, I was missing the .Run in main, thought it was something silly. The form now appears but it is blank (no text, fields etc displaying), probably something else missing. Regards Active
BTW: Are you creating all this by hand? If so, why? You do realise that VS can create a "tidier" version of all that for you automatically?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
I don't see any form constructor in your code? So what is calling InitializeComponent - if you don't call that in a constructor, then there will be nothing to show!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
As you say the form constructor was missing (previously created by another form), silly me, again. Now working. I appreciate your help OriginalGriff, thanks again. Regards Active
-
As you say the form constructor was missing (previously created by another form), silly me, again. Now working. I appreciate your help OriginalGriff, thanks again. Regards Active
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Thanks OriginalGriff Apologies, should have made my description clearer, the form never actually appears (or if it does then it quickly disappears), it is the only form currently and I am not entering / selecting anything (I don't get the chance). Any thoughts appreciated. Regards Active
Then where is the code to display the form? It won't appears magically... (except for the initial form which is initialized by the application).
Philippe Mori
-
Hi All Would appreciate some help on the following code which results in the form disappearing, rather than persisiting. Probably something really silly (code newbie, please be gentle). using System.ComponentModel; using System.Drawing; using System.IO; using System.Windows.Forms; namespace TCPReader { public class frmConfiguration : System.Windows.Forms.Form { private void frmConfiguration_Load(object sender, System.EventArgs e) { } private System.Windows.Forms.Button btnok; private System.Windows.Forms.Button button2; private System.ComponentModel.IContainer components; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; public USBReader.readerqueue m_queue; public USBReader.Socketclient m_sclient; public System.Threading.Thread thread1; public System.Threading.Thread threadClient; private System.Windows.Forms.TextBox txtipaddres; private System.Windows.Forms.TextBox txtportno; private void btnok_Click(object sender, System.EventArgs e) { try { bool flag = txtipaddres.Text != "" && txtportno.Text != ""; if (!flag) { System.Windows.Forms.MessageBox.Show("Enter IP Address and Port No to Connet\n to the Node", "Node Control", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Asterisk); Show(); } else { System.IO.TextWriter textWriter = System.IO.File.CreateText(System.Windows.Forms.Application.StartupPath + "\\IPAddress.txt"); textWriter.WriteLine(txtportno.Text + ";" + txtipaddres.Text); textWriter.Close(); DialogResult = System.Windows.Forms.DialogResult.OK; Close(); } } catch (System.Exception e1) { } } private void button2_Click(object sender, System.EventArgs e) { DialogResult = System.Windows.Forms.DialogResult.Cancel; Close(); } private void Configuration_Load(object sende