How to get the values of a textbox?

Asked

Viewed 9,699 times

-1

I created an example for you to see.

inserir a descrição da imagem aqui

The problem is this. I’m trying to get the value contained in TextBox converting to a string type to be able to use in the MessageBox, but he keeps showing off

System.Windows.Forms.Textbox, Text: hi

I wanted to know the correct way to capture the value of the textbox.

2 answers

4


-3

The TextBox is the type Text. So whenever you use one TextBox, Label or ComboBox, in the end you have to put your type, which in this case is .Text

Try it like this:

var gravar = NOMEDATEXTBOX.Text;

MessageBox.Show(gravar, "Test");
  • There is no type Text. Text is the property name only.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.