Click here to Skip to main content
15,891,662 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more: , +
Failed to convert parameter value from a String to a Boolean. this is error message
Posted
Updated 15-Jul-12 20:29pm
v2

As the message suggets, this error occurs when you try and convert a string to a boolean type.

Debug and step through your code. Find the line where this error occurs and try and figure out why you are doing the conversion.
You can use the Boolean.TryParse method[^] to avoid this error.
 
Share this answer
 
Comments
Yatin chauhan 16-Jul-12 3:21am    
can you put your code here that we can try to solve that problem.
Mohamed Mitwalli 16-Jul-12 3:59am    
5+
Abhinav S 16-Jul-12 13:07pm    
Thank you.
Hi ,
C#
bool xxx = bool.TryParse("false", out xxx);
        //return if true or false if succeeded return true and if faild return false
        if (xxx == true)
        {
            bool y = Convert.ToBoolean(xxx);
            Response.Write("<script>alert('"+xxx.ToString() +"')</script>");
        }
        else
        {
            Response.Write("<script>alert('Failed')</script>");
        }

Best Regards
M.Mitwalli
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900