private void btn_login_Click(object sender, EventArgs e) { if (txtUser.Text != "" || txtPass.Text != "") { SqlConnection dataConnection = new SqlConnection(_connectionString); dataConnection.Open(); //odpremo povezavo string poizvedba = "Select Count(*) from Users where username='******' and password='******'"; using (SqlCommand dataCommand = new SqlCommand(poizvedba, dataConnection)) { if (System.Convert.ToInt32(dataCommand.ExecuteScalar()) == 1) //preverimo, če je bila poizvedba uspešna { _username = txtUser.Text; this.Hide(); //skrijemo prijavni obrazec FMarket meni = new FMarket(); //nov objekt za glavni obrazec meni.Show(); } else { MessageBox.Show("Wrong password or username!!"); Ponastavi(); } } } else { MessageBox.Show("Please check your inputs!"); } }
private async void button1_Click(object sender, EventArgs e) //coinmarket { // start the waiting animation progressBar1.Visible = true; progressBar1.Style = ProgressBarStyle.Marquee; // simply start and await the loading task button1.Enabled = false; await Task.Run(() => LoadExcel()); FMarket f1 = new FMarket(); f1.Show(); // re-enable things button1.Enabled = true; progressBar1.Visible = false; }