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 ca开发者_开发问答n achieve this?
You can do it like 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();
精彩评论