Inserting double quotes in a textbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gomzi
    Contributor
    • Mar 2007
    • 304

    Inserting double quotes in a textbox

    hi,
    Is there a way for inserting double quotes in a texbox?

    i.e. i would like achieve something like this ->

    Gomzi"Gomzi (should be displayed in a textbox).

    Tried both using backslashes and html encode without much success.
  • Hybrid
    New Member
    • May 2007
    • 6

    #2
    textBox1.Text = '"' + "lawl" + '"';

    This isolate's the qutations into "char's".

    Comment

    • vanc
      Recognized Expert New Member
      • Mar 2007
      • 211

      #3
      If you want to display any special character, just add "\" before it (without double quotes)

      eg: Console.WriteLi ne("ab\"cd"); --> ab"cd

      cheers.

      Comment

      • gomzi
        Contributor
        • Mar 2007
        • 304

        #4
        Originally posted by Hybrid
        textBox1.Text = '"' + "lawl" + '"';

        This isolate's the qutations into "char's".
        Doesn't work. I get an error :- 'Expression expected'

        Comment

        • gomzi
          Contributor
          • Mar 2007
          • 304

          #5
          Originally posted by vanc
          If you want to display any special character, just add "\" before it (without double quotes)

          eg: Console.WriteLi ne("ab\"cd"); --> ab"cd

          cheers.
          Would like to input double quotes inside a texbox. The above method doesn't work in that case.

          Comment

          • vanc
            Recognized Expert New Member
            • Mar 2007
            • 211

            #6
            Did you try it, my friend?

            txtTemp.Text = "abc\"dhnc" ;
            output: abc"dhnc

            Comment

            • gomzi
              Contributor
              • Mar 2007
              • 304

              #7
              Originally posted by vanc
              Did you try it, my friend?

              txtTemp.Text = "abc\"dhnc" ;
              output: abc"dhnc
              of course i did.
              i m getting two errors.
              1->End of statement expected.
              2->syntax error

              My code :-

              Me.txtpath.Text = "<a href=http://myurl.com?url=s omething>"

              [I have left out the rest of the strings.]

              i would like to place double quotes around href.
              how should i go about it?

              Comment

              • vanc
                Recognized Expert New Member
                • Mar 2007
                • 211

                #8
                I think we were talking about C# now you switch to VB!!! In VB two double quote = one double quote.

                txtpath.Text = "AB""CD"
                Output: AB"CD

                Is your problem done?

                Comment

                • gomzi
                  Contributor
                  • Mar 2007
                  • 304

                  #9
                  Originally posted by vanc
                  I think we were talking about C# now you switch to VB!!! In VB two double quote = one double quote.

                  txtpath.Text = "AB""CD"
                  Output: AB"CD

                  Is your problem done?
                  I don't remember ever mentioning that I was talking of c#.
                  You were posting in c# and I assumed that the method would be the same for vb.net also. May be that was my fault.
                  Anyway, the above method you specified works great.
                  Thanks.

                  Comment

                  Working...