Solved

How do I write code for the updown control??

Posted on 2000-03-12
2
150 Views
Last Modified: 2010-05-02
i need to write code using the updown control to increment or decrement a number.  The user enters a number in a textbox, then after the number is entered they have the option to increment the number or decrement it.  I got it to work for incrementing the number, the only problem is that when the down arrow is pressed it still increments the number.  Example: Private Sub UpDown2_Change()
 txtcentigrade.Text = txtcentigrade.Text + UpDown2.Increment
End Sub
I am hopeless, can anyone help me??
0
Comment
Question by:sf129
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 9

Accepted Solution

by:
Ruchi earned 75 total points
ID: 2611119
try something like this..

Private Sub UpDown1_DownClick()
Text1.Text = Text1.Text - UpDown1.Increment
End Sub

Private Sub UpDown1_UpClick()
Text1.Text = Text1.Text + UpDown1.Increment
End Sub
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2611156
The UpDown control has the following three events--
1. Change - occurs any time the Value property of the control is changed.
2. DownClick - occurs when you click the down arrow of the control
3. UpClick - occurs when you click the up arrow of the control.

Hope this helps you.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question