It give me an error, don't know why. I want to replace ' with ".
try
{
txtCS.Text.Replace("'", """);
}
catch
{
}
The Replace method 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.
txtCS.Text = txtCS.Text.Replace("'", "\"");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With