Solved

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

Posted on 2008-06-19
3
228 Views
Last Modified: 2013-12-16
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,
WD
TextBox singleEntry = textBoxSingle.Text;

Open in new window

0
Comment
Question by:wally_davis
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
YourReference earned 250 total points
ID: 21827203
System.Windows.Forms.MessageBox.Show(singleEntry);
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 21827214
it should be like:

System.Windows.Forms.MessageBox.Show(yourTextBox.Text);
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 21827219
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
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question