Jump to content
  • Advertisement
Sign in to follow this  
Marz

Visual basic 6 scroll bars

This topic is 4879 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a text box with an ability score inside. I have placed a tiny scroll bar to its immediate right. The score inside is an integer variable. I want the scroll bar to add one to the variable displayed in the text box if clicked upward and to subtract one to the value if clicked downward. I for the life of me cannot get this to work. I would greatly appreciate any help. Please use laymen’s terms. Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Yeah, or even two seperate buttons if you like. One for plus and one for minus.

Scroll bars require you to have a maximum and a minimum value - the default is 0-10 I think. If that's what your looking for then great but by the sounds of it it isn't.

If your using command buttons you'd do

Addition command button (cmdAdd perhaps)
Text1.text = val(Text1.text) + 1

Subtraction command button (cmdSubtract)
Text1.text = val(Text1.text) - 1

For a scroll bar, remember to set the min and max vals first then simply do in the
scroll bar change event :
Text1.text = vscrollbar1.value

Matt

Share this post


Link to post
Share on other sites
You can also update the scroll bar value from the text value if you want to keep them in sync.
in the text change method, you can put vscroll1.value = val(text1.text)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!