private void OkButton_Click(object sender, EventArgs e) { TwitterConnection twitterConnection = new TwitterConnection(); twitterConnection.ConsumerKey = consumerKeyTextBox.Text; twitterConnection.ConsumerSecret = consumerSecretTextBox.Text; twitterConnection.UserAccessToken = userAccessTokenTextBox.Text; twitterConnection.UserAccessSecret = userAccessSecretTextBox.Text; try { twitterConnection.Connect(); if (RememberCheckBox.Checked) { twitterConnection.SaveCredentialsToReqistry(); } else { twitterConnection.ResetCredentialsToReqistry(); } this.DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show("Wrong Credentials Or Connection Error :-(" + Environment.NewLine + ex.ToString()); } }