Convert string to bool error
In my program i write 1 if else condition. In if (txt1.Text=" ") the value of txt1 is integer. So it genrate error Can not convert string to bool. So how to convert string to bool in program
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Mukesh KumarRank #615 · 3.9K reputationPosted Jan 17, 2012, 2:19 AM EST
Try this
if (txt1.Text==" ")
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 17, 2012, 3:11 AM EST
try following code
if (!string.IsNullOrWhiteSpace(txt1.text))
{
}
hope this help
VulpesRank #55 · 29.2K reputationPosted Jan 17, 2012, 4:02 AM EST