It give me an error, don’t know why. I want to replace ' with ".
try
{
txtCS.Text.Replace("'", """);
}
catch
{
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
Replacemethod returns a string because strings themselves are immutable. This means that instead of changing the existing string (txtCS.Text), it creates a new string object and so you need to assign that new string object to the textbox.Also, you’re missing the escape character in your quotes. By adding a
\, you can use the"character, otherwise the compiler thinks you’re closing the string.