Solved

vb.net numericupdown control

Posted on 2009-05-12
2
557 Views
Last Modified: 2012-05-06
I'm using several of these to allow the user to enter different values (both integer & decimal, if it matters).
I'd like the functionality where, once the user tabs or otherwise sets focus on the control, the current value (typically 0 or 0.0) would be highlighted so it could be typed over, without having to remove the 0/0.0 value that's there before typing the new value...
0
Comment
Question by:sirbounty
2 Comments
 
LVL 19

Accepted Solution

by:
Rimvis earned 125 total points
ID: 24371740
Hello sirbounty,

You can use MouseDown and Enter events, like this:


    Private Sub NumericUpDown1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.Enter
        NumericUpDown1.Select(0, NumericUpDown1.Value.ToString().Length)
    End Sub 

    Private Sub NumericUpDown1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NumericUpDown1.MouseDown
        NumericUpDown1.Select(0, NumericUpDown1.Value.ToString().Length)
    End Sub

Open in new window

0
 
LVL 7

Expert Comment

by:meispisces
ID: 24371908
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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