How to let MessageBox display boolean value?

  • Thread starter Thread starter Tee
  • Start date Start date
T

Tee

Hi,

I have a boolean variable, I need to see it's true or false from a
MessageBox.Show, but when I try to compile, I keep on getting error, "cannot
convert from 'bool' to 'string'". This is clear enough what's the problem,
but anyone know how to display a true/false in MessageBox?


Thanks,
Tee
 
You need to convert the bool to string, sport.
try
bVar.ToString()


Shane Sukul
BSC MCSD MCAD
 
Hi Tee!

I have a boolean variable, I need to see it's true or false from a
MessageBox.Show, but when I try to compile, I keep on getting error,
"cannot
convert from 'bool' to 'string'". This is clear enough what's the problem,
but anyone know how to display a true/false in MessageBox?

//your boolean variable
bool myBool = false;

//use it in a MsgBox
MessageBox.Show(myBool.ToString());

Cheers

Arne Janning
 
Sport,

You need to convert the boolean to a string.

Try

boolVar.ToString();

With Regards
Shane Sukul
BSC MCSD MCAD
 
Back
Top