Hi all,
C# novice here, when the int 'max' below is 0 I get a divide by zero error, I can see why this happens but how should I handle this when max is 0? position is also an int.
private void SetProgressBar(string text, int position, int max)
{
try
{
int percent = (100 * position) / max; //when max is 0 bug hits
string txt = text + String.Format(". {0}%", percent);
SetStatus(txt);
}
catch
{
}
}
Many thanks