Link to home
Start Free TrialLog in
Avatar of rwheeler23
rwheeler23Flag for United States of America

asked on

C# displaying progress using a label while importing using a spreadsheet a boolean method

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.");
            }
        }
ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial