[Solved] Maximum value in the track bar


The message already says all: The value may not be greater than the max-value.

Just add a condition before you increment the value:

if (trackBar1.Value < trackBar1.Maximum)
    trackBar1.Value++; 

Or here your complete event handler:

private void button41_Click(object sender, EventArgs e)
{
    if (trackBar1.Value < trackBar1.Maximum)
    {
        trackBar1.Value++;
        label27.Text = trackBar1.Value;
    }
    else
    {
        MessageBox.Show("Max value = " + trackBar1.Maximum);
    }
}

1

solved Maximum value in the track bar