So I'm trying to increase the Progress bar inside a foreach loop based on the number of lines processed in a file but it doesn't seem to work, not sure why maybe my maths is off?
Example of code
var lines = File.ReadAllLines(file);
size = lines.Length;
int progress = 100 / size;
foreach (var line in lines){
progressBar1.BeginInvoke((MethodInvoker)delegate () {
progressBar1.Value += progress;
});
}