private void login()
        {
            string hcon = "Data Source=" + instance + ";Initial Catalog=" + databaseName + ";User ID=" + userID + ";Password="******"select * from usercredentials", historycon);



                historycon.Open();
                historyreader = historycom.ExecuteReader();
                while (historyreader.Read())
                {
                    string username;
                    if (textBox1.Text == (username = historyreader["UserID"].ToString()))
                    {
                        if (textBox2.Text == (ID = historyreader["userpassword"].ToString()))
                        {
                            ID = username;
                            if (checkBox1.Checked == true)
                            {
                                try
                                {
                                    RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\securewebbrowser");

                                    key.SetValue("user", textBox1.Text);
                                    key.SetValue("pass", textBox2.Text);
                                    key.SetValue("remember", "yes");
                                }
                                catch (Exception re)
                                {
                                    MessageBox.Show("Sorry, we are not allowed to write settings to the registry.", "Oops!");
                                }
                            }

                            else
                            {
                                try
                                {
                                    RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\securewebbrowser");

                                    key.SetValue("user", "");
                                    key.SetValue("pass", "");
                                    key.SetValue("remember", "no");
                                }
                                catch (Exception re)
                                {
                                    //MessageBox.Show("Sorry, we are not allowed to write settings to the registry.", "Oops!");
                                }
                            }

                            var f1 = new Browser(username, instance, userID, password, databaseName);

                            f1.Show();
                            this.Hide();



                            break;
                        }
                        else
                        {
                            MessageBox.Show("Please check caps lock, verify password and try again !", "Invalid password for user " + username);
                        }
                    }
                }
                if (ID == null)
                {
                    MessageBox.Show("User does not exist!", "Invalid user");
                }
                var f3 = new LoginForm();
                f3.Hide();
                historycon.Close();
            }
            catch (SqlException se)
            {
                MessageBox.Show("Error :" + se);
            }
        }