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. Windows Forms
  4. Form disappearing

Form disappearing

Scheduled Pinned Locked Moved Windows Forms
csharpvisual-studiographics
1 Posts 1 Posters 3 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.
  • U Offline
    U Offline
    User 2387889
    wrote on last edited by
    #1

    Hi All Having some trouble trying to get a form to persist, rather than disappearing / not appearing when run. Probably something silly, command in the wrong location etc C#, Visual Studio. Code newbie, please be gentle.

    using System;
    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 Configurati
    
    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