hi i would like to ask if how to con开发者_如何学Cvert the Console.WriteLine to Textbox and this the line sorry im just a newbie ....thank you
Console.WriteLine(" Status: {0}", adapters[i].OperationalStatus.ToString())
What do you mean convert Console.WriteLine to a Textbox? If you just want the Textbox to display the text, set the Text property.
TextBoxId.Text = String.Format(" Status: {0}", adapters[i].OperationalStatus.ToString());
You can do:
Your_TextBox.Text = String.Format("Status:{0}",
adapters[i].OperationalStatus.ToString())
http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.aspx
TextBox.Text = String.Format(" Status: {0}", adapters[i].OperationalStatus.ToString());
I like using String.Format
as much as @Brandon and @Neil Knight do, but here's an alternative (not necessarily a better one):
myTextBox.Text = " Status: " + adapters[i].OperationalStatus.ToString();
精彩评论