本文介绍了大家好,如果进度条完成后如何给出消息框代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private void button2_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
MySqlConnection con = new MySqlConnection(@"Data Source=localhost; Database=nigol; User ID=**; Password=**");
MySqlCommand cmd = new MySqlCommand("INSERT INTO masterlist (PROBER_ID,IP_ADDRESS,LEVEL) values (@PROBER_ID,@IP_ADDRESS,@LEVEL)", con);
//string InsertString = @"IF NOT EXISTS (SELECT * FROM from nigol.masterlist WHERE PROBER_ID, IP_ADDRESS, LEVEL = @PROBER_ID, @IP_ADDRESS, @LEVEL)";
cmd.Parameters.AddWithValue("@PROBER_ID", dataGridView1.Rows[i].Cells[0].Value);
cmd.Parameters.AddWithValue("@IP_ADDRESS", dataGridView1.Rows[i].Cells[1].Value);
cmd.Parameters.AddWithValue("@LEVEL", dataGridView1.Rows[i].Cells[2].Value);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
{
progressBar1.Maximum = dataGridView1.Rows.Count;
progressBar1.Value = i;
}
}
}
推荐答案
// before the for loop
progressBar1.Maximum = dataGridView1.Rows.Count;
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
// your code..
}
// after the for loop
if(progressBar1.Value == dataGridView1.Rows.Count - 1)
{
MessageBox.Show("Ta Da!");
}
put double =
:叹息:
-KR
put double =
:sigh:
-KR
这篇关于大家好,如果进度条完成后如何给出消息框代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!