private void btnOk_Click(object sender, EventArgs e) { try { if (txtVsVersion.Text == string.Empty) { txtVsVersion.Select(); MessageBox.Show("Please input the VS Version name!", CGConstants.MSG_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ConfigCtrl.IsVsTemplateExist(txtVsVersion.Text)) { txtVsVersion.Select(); MessageBox.Show("The VS Version has already existed!", CGConstants.MSG_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ConfigCtrl.AddVsTemplate(txtVsVersion.Text); _newvsversionname = txtVsVersion.Text; this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }