简体   繁体   中英

How to display data inside a textbox?

My question is that I have extracted data from a file and pushed into a string variable.

I have a FORM created in visual studio having a text box, so I want to display that extracted data in textbox created.

How can achieve this?

你可以这样做:

yourTextBox.Text = yourString;

For a TextBox, it is just

myTextBox.Text = myStringVariable;

But if the data is large, you may want to consider the RichTextBox control instead.

This is all assuming you're using Windows Forms...

string strName="someone";
TextBox1.Text=strName;

If you trim the data to remove the unwanted trailing spaces if there is any.

TextBox1.Text=strName.Trim();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM