Hi everyone!

Imagine that i have a timer that each 30 seconds it adds 3 to the variable final. Variable final is shown on excel sheet when user press "Export", on cell [5,2].
I added this on the timer:

numero++;

            if (numero == 5)
            {
                numero = 0;
                final += 3;
            }
            
                label1.Text = final.ToString();

Then next time user opens the program and push start button again (timer start) i want to add this time to the previously time on the excel sheet.

I had already done the function that saves the file . .

string activDir = @"C:";
    string newPath = System.IO.Path.Combine(activDir, "exemplo");
    System.IO.Directory.CreateDirectory(newPath);

    ws.SaveAs(@"C:\exemplo\teste.xls");

Now i just need that. . Each time the user presses "Export" first of all program needs to read what is is cell [5,2] and then add the new final value.

Read value from excel sheet from the cell "cell [5,2]" and assign it to "final" variable when you start program each time.

Thanks, i'm getting an error . "Cannot convert null to 'double' because it is a non-nullable value type" What's the problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.