I have a winform with a label called lblCustNmbr. I need to read a spreadsheet and update a table in SQL. I current have a boolean method that will return true of false after all records are read. Defining this method as
private static bool UpdateDeliveryDays(string InputFilename, string message)
{
Do Work
}
will not work as it does not recognize the label. How do I define the scope properly so customer numbers will appear on the winform while the update process is occurring but still maintain the status of the method performing the update?
private void btnImport_Click(object sender, EventArgs e)
{
bool success;
string inputFilename = string.Empty;
string message = string.Empty;
inputFilename = txtImportFilename.Text;
lblCustNmbr.Text = "Updating of delivery days started";
success = UpdateDeliveryDays(inputFilename,message); /* Update delivery days in GP */
if (success == false)
{
MessageBox.Show("Error updating deliver days");
}
else
{
MessageBox.Show("Delivery Days update completed.");
}
}