Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vscrollbar not incrementing a textbox value

Status
Not open for further replies.

animal

MIS
Aug 9, 2000
15
CA
I have a vscrollbar acting as a spinner to a text box. When I click the vscrollbar, I want the number to increment or decrement...no problem:

In the Form_Load:
vscroll1.min = -1
vscroll1.max = -100

In the vscroll1_Change:
text1.text = format$(abs(vscroll1.value))


Now if I have a value in text1.text, like say 3, I would like to increment or decrement starting from 3, not the Min value of the vscrollbar.
How can this be done????
 
ahh.... Just reassign the value of the Vscrollbar min to the text1.text???

Pretty simple if I understand your question.

John Stephens
 
If I reassign the vscrollbar's Min value to 3 as per my example, then I would not be able to go below 3...my valid range is 1 to 100.
I tried this in the vscroll1_change event but it still didn't behave properly.
 
There is a control designed specifically for this. It is called an UpDown control. To add it to the toolbox, go to Project/Components and check Microsoft Windows Common Controls-2 6.0. Then add it to a form and add your textbox. Set the name of each. Now go into the Custom properties for the UpDown control, choose the buddy tab, and set the following properties:
Buddy Control = your text box name
SyncBuddy = checked
Buddy Property = text

This should now work the way you want, without any code!
 
Thanks, the UpDown control did the trick!!!
I guess I should go through some of these included components some day.
 
No problem.

One thing that definitely gets your apps to the next level is to use some of the standard components, especially the ones in Microsoft Windows Common Controls 6.0. This includes the status bar, the progress bar, tabs, treeview, listview, any of which can make your app more professional looking.

Have fun.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top