I am using a trackbar to adjust the value accordingly and the output is shown in a text box. I want to show the value with some text after it. The code I have used shows the text I want displayed however also shows this; i.e. slider moved to 200.
i.e. windowsforms.textbox.text: 200 °C
private void trackBar_Temp_Scroll(object sender, EventArgs e)
{
Oven_Temp.Text = trackBar_Temp.Value.ToString();
Oven_Temp.AppendText(Oven_Temp + "°C");
}
How comes the code shows the windows form section in the output with this code?
Your call to append the text should just be: Oven_Temp.AppendText("°C");
Better yet, use string concatenation to just do it all in one line:
Oven_Temp.Text = trackBar_Temp.Value.ToString() + "°C";
The problem is that you are including Oven_Temp
inside your call to AppendText
, which is the textbox object itself. So the type name of the textbox then shows up in your output.