atsiee
atsiee

Reputation: 37

how to convert this code

hi i would like to ask if how to convert the Console.WriteLine to Textbox and this the line sorry im just a newbie ....thank you

Console.WriteLine("    Status:            {0}", adapters[i].OperationalStatus.ToString())

Upvotes: 0

Views: 134

Answers (4)

Joel Etherton
Joel Etherton

Reputation: 37533

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

Upvotes: 0

kemiller2002
kemiller2002

Reputation: 115420

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

Upvotes: 1

Brandon
Brandon

Reputation: 69973

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

Upvotes: 2

Neil Knight
Neil Knight

Reputation: 48537

TextBox.Text = String.Format("    Status:      {0}", adapters[i].OperationalStatus.ToString());

Upvotes: 0

Related Questions