none
Value of type 'String' cannot be converted to 'System.Windows.Forms.RichTextBox'

    Question

  • This is the error I get:

    Error 1 Value of type 'String' cannot be converted to 'System.Windows.Forms.RichTextBox'.

    and it brings me here: Me.Text = "Text_Preview"

    Monday, July 08, 2013 7:41 PM

Answers

  • I'm totally guessing at the code that you're not showing, but my guess is that what you want to do is something more like:

    RichTextBox1.Text = "This is the text you want in your RTB"

    If you were to do something like this:

    RichTextBox1 = "This is the text..."

    ... then you'd get that exception.

    *****

    If that's not it then please show more of the code where the exception occurs.


    Please call me Frank :)

    • Marked as answer by Carter_N349NB Monday, July 08, 2013 8:00 PM
    Monday, July 08, 2013 7:52 PM
  • I'm totally guessing at the code that you're not showing, but my guess is that what you want to do is something more like:

    RichTextBox1.Text = "This is the text you want in your RTB"

    If you were to do something like this:

    RichTextBox1 = "This is the text..."

    ... then you'd get that exception.

    *****

    If that's not it then please show more of the code where the exception occurs.


    Please call me Frank :)

    That's not it, nut I did help me figure out what the problem is, I had the rich text box named "Text" so in the code it was text.text which I think has caused the error. 

    Thanks for helping Frank!

    Monday, July 08, 2013 7:58 PM

All replies

  • I'm totally guessing at the code that you're not showing, but my guess is that what you want to do is something more like:

    RichTextBox1.Text = "This is the text you want in your RTB"

    If you were to do something like this:

    RichTextBox1 = "This is the text..."

    ... then you'd get that exception.

    *****

    If that's not it then please show more of the code where the exception occurs.


    Please call me Frank :)

    • Marked as answer by Carter_N349NB Monday, July 08, 2013 8:00 PM
    Monday, July 08, 2013 7:52 PM
  • I'm totally guessing at the code that you're not showing, but my guess is that what you want to do is something more like:

    RichTextBox1.Text = "This is the text you want in your RTB"

    If you were to do something like this:

    RichTextBox1 = "This is the text..."

    ... then you'd get that exception.

    *****

    If that's not it then please show more of the code where the exception occurs.


    Please call me Frank :)

    That's not it, nut I did help me figure out what the problem is, I had the rich text box named "Text" so in the code it was text.text which I think has caused the error. 

    Thanks for helping Frank!

    Monday, July 08, 2013 7:58 PM
  • That's not it, nut I did help me figure out what the problem is, I had the rich text box named "Text" so in the code it was text.text which I think has caused the error. 

    Thanks for helping Frank!

    Yea, that would do it! ;-)

    Please call me Frank :)

    Monday, July 08, 2013 8:01 PM