Mx321
Mx321

Reputation: 31

Displaying data from a int variable in a rich text box in c#

I have been trying to get a rich text box to display the current cpu usage from a variable I created when I click a button, but does not work when I use .appendText because it is an int could anyone show me how to do this?

   private void button2_Click(object sender, EventArgs e)
    {

    }

Upvotes: 0

Views: 1759

Answers (1)

Jan Köhler
Jan Köhler

Reputation: 6032

The AppendText-method only accepts parameters of type string. So you have to convert your int-variable .ToString().

private void button2_Click(object sender, EventArgs e)
{
    RichTextBox1.AppendText(yourVariable.ToString());
}

Upvotes: 2

Related Questions