user1050632
user1050632

Reputation: 668

c# write message to textbox

Kind of new to c# GUI stuff

I am trying to output a message, a number to a textbox.

1 Button will calculate the number, then I want to write a message like " Number has been seen: "

I tried

Form2.resultBox.Text.Write("Number one has been seen: ", num0);

that doesn't work.

Also tried

Form2.resultBox += Console.WriteLine("Numer one has been seen: ", num0);

Im going to have about 16 of these messages

ideas?

Upvotes: 0

Views: 15666

Answers (3)

MethodMan
MethodMan

Reputation: 18843

how about using the string.Format

Form2.resultBox.Text = string.Format("Number one has been seen: {0}", num0); 

eliminates having to use + sign

Upvotes: 1

Jason Williams
Jason Williams

Reputation: 1283

To set the value of a TextBox, you should set a value on the Text property like so:

resultBox.Text = "Number one has been seen: " + num;

Upvotes: 1

Bas
Bas

Reputation: 27085

Form2.resultBox.Text = "Number one has been seen: " + num0;

Upvotes: 2

Related Questions