How to convert textbox.text to string?

I have a couple of textboxes that I am trying to concatenate and I receive some error about that. Here's what I have.

string strSummary;

strSummary = txtFstName.Text + " " + txtLstName.Text;

The error message is:

Cannot convert from 'System.Web.UI.WebControls.TextBox' to 'string'

Your help is appreciated.


Answer this question

How to convert textbox.text to string?

  • JeffRusso

    You're right. That wasn't the problem. It's something else. I got it fixed now. Thanks!
  • wes73

    The TextBox.Text property is type of String, so this code can't have any problems. Are you sure you get this error on that statement

    The code doesn't give me any errors.



  • How to convert textbox.text to string?