public void button1_Click_1(object sender, EventArgs e) { try { string connectionstring; pictureBox3.Visible = true; connectionstring = textBox1.Text; string strerror = null; bool bret = appConnection.ConnectServer(connectionstring, strerror);// if (bret) { textBox3.Clear(); MessageBox.Show("The Client is connected to .....\n" + connectionstring.ToString(), "Mongo Manager Message", MessageBoxButtons.OK, MessageBoxIcon.Information); log.Info("The Client is connected to ..." + connectionstring.ToString()); richTextBox3.Text = richTextBox3.Text + System.Environment.NewLine + "user connected at " + DateTime.Now;// The log textBox3.Text = textBox3.Text + System.Environment.NewLine + "connected"; pictureBox2.Visible = true; if (pictureBox2.Visible == true) { pictureBox1.Visible = false; pictureBox3.Visible = false; } } else { textBox3.Clear(); richTextBox1.Clear(); MessageBox.Show("Failed to Create Client.....\n" + strerror, "Mongo Manager Error", MessageBoxButtons.OK, MessageBoxIcon.Error); log.Error("Failed to Create Client"); richTextBox3.Text = richTextBox3.Text + System.Environment.NewLine + "Connection Error at: " + DateTime.Now;// The log textBox3.Text = textBox3.Text + System.Environment.NewLine + "not connected"; comboBox3.ResetText(); comboBox4.ResetText(); pictureBox1.Visible = true; } if (pictureBox1.Visible == true) { pictureBox2.Visible = false; pictureBox3.Visible = false; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); log.Fatal(ex.ToString()); } }