Note that there are some explanatory texts on larger screens.

plurals
  1. POProgress Bar not updating
    text
    copied!<p>I have the following piece of code to write data to an XML file.</p> <pre><code>private void WriteResidentData() { int count = 1; status = "Writing XML files"; foreach (Site site in sites) { try { //Create the XML file StreamWriter writer = new StreamWriter(path + "\\sites\\" + site.title + ".xml"); writer.WriteLine("&lt;?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?&gt;"); writer.WriteLine("&lt;customer_list&gt;"); foreach (Resident res in site.GetCustomers()) { bw.ReportProgress((count / customers) * 100); writer.WriteLine("\t&lt;customer&gt;"); writer.WriteLine("\t\t&lt;customer_reference&gt;" + res.reference + "&lt;/customer_reference&gt;"); writer.WriteLine("\t\t&lt;customer_name&gt;" + res.name + "&lt;/customer_name&gt;"); writer.WriteLine("\t\t&lt;customer_address&gt;" + res.address + "&lt;/customer_address&gt;"); writer.WriteLine("\t\t&lt;payment_method&gt;" + res.method + "&lt;/payment_method&gt;"); writer.WriteLine("\t\t&lt;payment_cycle&gt;" + res.cycle + "&lt;/payment_cycle&gt;"); writer.WriteLine("\t\t&lt;registered&gt;" + CheckWebStatus(res.reference) + "&lt;/registered&gt;"); writer.WriteLine("\t&lt;/customer&gt;"); count++; } writer.WriteLine("&lt;/customer_list&gt;"); writer.Close(); } catch (Exception ex) { lastException = ex; } } } </code></pre> <p>It's using the same BackgroundWorker that gets the data from the database. My progress bar properly displays the progress whilst it is reading from the database. However, after zeroing the progress bar for the XML writing it simply sits at 0 even though the process is completing correctly.</p> <p>Can anyone suggest why?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload