How to Escape an Apostrophe in ASP.NET

104 20
    • 1). Click the Windows "Start" button and select "All Programs." Click "Microsoft .NET," then click "Visual Studio." Double-click your VB project file name to load the code in the software.

    • 2). Right-click the form file you want to edit in the "Solution Explorer" window. Select "View Code" to open the code section for the form.

    • 3). Scroll down to the location of the string that contains the apostrophe. In front of the apostrophe character, type a backslash. For instance, the following code "escapes" the apostrophe in a customer name:

      CustomerName = "Joe O\'Brian"

    • 4). Click the "Save" button in the main VB toolbar to save the code changes. Click the "Run" button in the toolbar to run the code in the VB debugger to test the new code.

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.