DoThix HowTo DoThix_HowTo DoThix HowTo DoThix_HowTo - 29 days ago 8
C# Question

Getting Cannot implicitly convert type 'int' to 'bool' error

if (progressBar1.Value = 100)
{
MessageBox.Show("Time Out!"), ("Timer!");
}


It Always Show me the Title Error

The error fixed, but message box not showing up lol...

Answer

In your if condition you are trying to assign 100 to progressBar1.Value using single =, to compare you need to use double == then progressBar1.Value == 100 statement will produce a Boolean value

if (progressBar1.Value == 100) 
{
   MessageBox.Show("Time Out!", "Timer!"); // with title
}

and your MessageBox with title should be like

MessageBox.Show("Time Out!", "Timer!");
Comments