title: Displaying Custom Progress Bar while Fetching Data From The C# Database
body: <p>I use the below code to fetch the data from database and display the data on dataGrid now How to Display Custom Progress bar while fetching the data from the database ? </p>
  
  <pre><code>private void ReadRecords(){
          using (SqlConnection c = new SqlConnection(Properties.Settings.Default.Database1ConnectionString)) {
              try{
                  c.Open();
                  if (c.State == ConnectionState.Open) {
                      using (SqlDataAdapter a = new SqlDataAdapter("SELECT * FROM Items ORDER BY item_id", c)) {
                          try {
                              DataTable t = new DataTable();
                              a.Fill(t);
                              dataGridView1.DataSource = t;
                          }
  
                          catch(Exception ex){
                              MessageBox.Show("Failed Fill Data :." + ex);
                              return;
  
                          }
                      }
                  }
              }
  
              catch (Exception ex)
              {
                  MessageBox.Show("Failed To Open Connection :." + ex);
                  return;
              }
          }
  
      }
  </code></pre>