Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is some sample code, I would like the slider result to update the textbox field when it moves

privatevoid trackBar1_Scroll(object sender, EventArgs e) {  
    MessageBox.Show(trackBar1.Value.ToString());  
}  


What I've tried gives the message, "Textbox.Text" cannot be used like a method.

What I have tried:

txtHeight.Text(trackBar1.Value.ToString());
Posted
Updated 28-Jul-21 2:58am
Comments
CHill60 28-Jul-21 8:47am    
You would assign a value to the Text property of the textbox e.g.
txtHeight.Text = trackBar1.Value.ToString();

1 solution

Do it like this:
private void trackBar1_Scroll(object sender, EventArgs e)
{
    textBox1.Text = trackBar1.Value.ToString();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900