Increasing/Decreasing integers using a vertical scroll bar
Hello all,
I am attempting to create something that will allow me to have an integer increase or decrease by one every time something such as a vertical scrollbar is hit up or down.
pseudocode goes something like this:
int targetNumber;
if(vsscrollbar is clicked up)
increase targetNumber;
if(vsscrollbar is clicked down)
decrease targetNumber;
Is there any way to do this using the VSScrollBar? I'm not familiar with the control and I looked at it's properties and methods but all I could find was ValueChanged, which didn't get me very far.
Any help is appreciated.
Thanks
JasonPosted Mar 22, 2007, 11:41 AM
I had originally tried writing a handler like you showed, only I was using the ValueChanged event instead of the Scroll event, so it wasn't working out very well heh.
I'll try the numeric up/down control tonight when I get home.
Scott LyslePosted Mar 21, 2007, 11:09 PM
Aside from that, the standard trackbar control can be oriented vertically or horizontally and it can be used to increment an integer value within a defined range (min to max value).
If you absolutely want to use a scrollbar, you can do that as well by writing a handler for the scroll event.
private
void hScrollBar1_Scroll(object sender, ScrollEventArgs e){
label1.Text = hScrollBar1.Value.ToString();
}