title: C# - How To Use ProgessBar While DataGridView Filling
body: <p>I have a DataGridView and it has so many rows. It takes a long time to load. And I want to add a ProgressBar when it load. How can I add a ProgressBar with manquee style to my code. (P.S. : I don't know my DataGridView's rows count, it change everytime.)</p>
  
  <p>It's my code;</p>
  
  <pre><code>     conection.Open();
       string[] ss = listBox2.SelectedItem.ToString().Split(' ');
       int countss = ss.Count();
       for (int mi = 0; mi &lt; countss; mi++)
       {
           string mq = "select c1, c2, c3 from myTableName WHERE c1='" + ss[mi] + "' OR c2='" + ss[mi] + "'";
           SqlDataAdapter s = new SqlDataAdapter(mq, connection);
           DataTable d = new DataTable();
           s.Fill(d);
           foreach (DataRow r in d.Rows)
           {
               dgv1.Rows.Add(r["c1"].ToString() + " " + r["c2"].ToString(), r["c3"]);
           }
       }
       //Some insignificant operations...
       for (int mi2 = 0; mi2 &lt; cmn; mi2++)
       {
           string mq2 = "select c1, c2, c3 from myTableName WHERE c1='" + cmn[mi2] + "' OR c2='" + cmn[mi2] + "'";
           SqlDataAdapter s2 = new SqlDataAdapter(mq2, conection);
           DataTable d2 = new DataTable();
           s2.Fill(d2);
           foreach (DataRow r2 in d2.Rows)
           {
               dgv2.Rows.Add(r2["c1"].ToString() + " " + r2["c2"].ToString(), r2["c3"]);
           }
       }
       coneciton.Close();
  </code></pre>