private void btnOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tbInput.Text.Trim())) { MessageBox.Show("Please input something!"); return; } Result = tbInput.Text; DialogResult = DialogResult.OK; Close(); }