开发者

how to convert this code

开发者 https://www.devze.com 2023-02-15 02:52 出处:网络
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

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();
0

精彩评论

暂无评论...
验证码 换一张
取 消