¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: twsapi: Spin buttons?


cyberbri_2000
 

Here's one example...

Sub Form_Load()
UpDown1.Increment = 1
UpDown1.Min = 1
UpDown1.Max = 10
End Sub

Private Sub UpDown1_Change()
txtContracts.Text = UpDown1.value
End Sub

Then, to put that value in your buy order, don't forget to convert it
to a number...
val(txtContracts.Text)

For my own programs I would make it a label instead of a text box,
which would only allow the UpDown buttons to change the value,
instead of allowing a number to be typed in by the user. Then you
could place code in the UpDown1_Change, like making sure the user has
available capital for the number selected, etc.

Brian

Hi Scott,

I am having a bit of trouble getting this to work.

Private Sub UpDown1_Change()

End Sub

WHat do I need to put in between the above code to
increase/decrease the value by 1 with a click of the up/down
buttons in a text box
called txtContracts.

Thanks,

Bruce

Join [email protected] to automatically receive all group messages.