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