Home > Enterprise >  Set Collection in TrackBar - Visual Basic
Set Collection in TrackBar - Visual Basic

Time:11-16

Is it possible to set a series (Collection) of fixed values so that the trackbar output only the values defined in the series? From the properties it seems you can only set min, max and TickFrequency, not the single possible values

Thanks

CodePudding user response:

Natively, the TrackBar control is purely numeric.

If you want to use it for something else, you must set it to have bounds of 0 and one less than the count of items, and then map the selection to the index in the collection yourself, while also using a label or similar to provide feedback to the user on what they chose. There is no automation here; you must do all of the plumbing for this on your own.

What you can do if this will be a common pattern in your application is make a custom control to build this logic once, and use instances of that same custom control in more than one place.

  • Related