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(); } }
private void btnReset_Click(object sender, EventArgs e) { this.cmbPort.DataSource = MyPort.getPorts(15); }
public hostPortForm() { InitializeComponent(); this.cmbPort.DataSource = MyPort.getPorts(15); }