How do you display the data you entered in a Textbox to a MessageBox in C#?

I've declared the variable "singleEntry" below as a TextBox. Not sure I've I should have declared the variable type as String. None the less, I want to display the data you enter in a Textbox to a MessageBox in C#?
Most grateful,
TextBox singleEntry = textBoxSingle.Text;

Open in new window

Who is Participating?
YourReferenceConnect With a Mentor Commented:
Jaime OlivaresSoftware ArchitectCommented:
it should be like:

Jaime OlivaresSoftware ArchitectCommented:
notice TextBox is a control class, not a string, if you want to use the string inside the control, you have to use the .Text property
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.