locked
Put quotes around selected text RRS feed

  • Question

  • Hello, I am brand new (2 days) to VB 2005 and have a question.

     

    I would like to be able to select text in a Rich Text or standard Text box, and then press a button (use a shortcut, use a pull-down menu, etc) and put quotes around it.

     

    For example I would like:

    This is a string

    to become

    "This is a string"

     

    Ideally I would like to do this in as few lines as possible.

     

     

    Thanks in advance

    Tuesday, October 16, 2007 8:04 PM

Answers

  • RichTextBox1.SelectedText = """" & RichTextBox1.SelectedText & """"

     

    Tuesday, October 16, 2007 8:40 PM

All replies

  • RichTextBox1.SelectedText = """" & RichTextBox1.SelectedText & """"

     

    Tuesday, October 16, 2007 8:40 PM
  • PERFECT!!!! Exactly what I was looking for.

     

    Thank you.

     

     

    One more question.  Is there anyway to have separate quotes for different selection sets?  For example I have info on lines one and three, but I want them to both have full quote marks around them, is there a way to do that?

    Example

    This:

    Line 1

     

    Line 3

     

    should become this:

    "Line 1"

     

    "Line 3"

    Tuesday, October 16, 2007 8:44 PM