How to Integrate a Trackbar into Visual Basic by awang8
trkbar.bmp
OK, so this sounds easy but the beginners have absolutely noidea how to do this. Trackbars can be useful tools. From deciding a budget to choosing how many fireworks to detonate, using trackbars are very very easily.

NOTE: Does anyone know how to increase the number of places on a trackbar? I can only get 11...
 
Remove these adsRemove these ads by Signing Up

Step 1: Get your Form ready

userif.bmp
This is pretty easy. Make when you want your program to look like. I'm not making anything in particular. I'll be making something that changes the colour of a textbox.

==Don't forget to add a trackbar!!!== Yes, alot of people forget that
ekulmeekul says: Feb 11, 2009. 9:32 PM
Have you tested this without the "end if" at the end of every "if then" statement?
awang8 (author) says: Feb 21, 2009. 2:19 AM
Ifs are expressions and need a End If otherwise it either automatically puts it in or comes up with a error.
Seifpic says: Feb 14, 2011. 6:36 PM
Actually, you should do it like this instead:
If trackbar1.value = 0 then
'do something
Else if if trackbar1.value = 1 then
'do something
End if
Gamernotnerd says: Aug 28, 2009. 7:27 PM
Slider1.Max = ("Value")
Slider1.TickFrequency = ("Value")

But that's VB6.
zaketus says: Feb 9, 2009. 2:35 AM
I haven't used VB almost at all (I've just made some simple controlling software for microcontroller projects few times). Is it possible to make color array? So you could replace that if then end if if then end if -"monster" with just
TextBox1.BackColor = colors (TrackBar.Value)
Or that might work with string array...

When working with some bigger sources it's much more comfortable to work, if code is compact (everything shouldn't be shrinked, but this kind of stuff can be, without making any harm).
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!