Ejemplo n.º 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            TextCheck tc = new TextCheck();

            if (!tc.checkInputPort(this.txtPort.Text))
            {
                MessageBox.Show(tc.WarningMessage);
                this.txtPort.Clear();
                this.txtPort.Focus();
                return;
            }



            if (!MyPort.checkPort(this.txtPort.Text))
            {
                MessageBox.Show("端口" + this.txtPort.Text + "已被占用,请重选选择,或者使用选择端口");
                this.txtPort.Clear();
                this.txtPort.Focus();
            }
            else
            {
                chatClientForm fm = (chatClientForm)this.Owner;
                GroupBox       gb = (GroupBox)((TabPage)((TabControl)fm.Controls["myTabControl"]).Controls["registrationTab"]).Controls["groupBox1"];
                ((TextBox)(gb.Controls["txtHostPort"])).Text = this.txtPort.Text;
                this.Close();
            }
        }
Ejemplo n.º 2
0
        private bool checkInput()
        {
            TextCheck tc = new TextCheck();

            if (!tc.checkInputIP(this.txtServerIP.Text))
            {
                MessageBox.Show("Server IP:" + tc.WarningMessage);
                this.txtServerIP.Clear();
                this.txtServerIP.Focus();
                return(false);
            }

            if (!tc.checkInputPort(this.txtServerPort.Text))
            {
                MessageBox.Show("Server port:" + tc.WarningMessage);
                this.txtServerPort.Clear();
                this.txtServerPort.Focus();
                return(false);
            }

            if (!tc.checkInputPort(this.txtHostPort.Text))
            {
                MessageBox.Show("Host port:" + tc.WarningMessage);
                this.txtHostPort.Clear();
                this.txtHostPort.Focus();
                return(false);
            }
            return(true);
        }