Solved

vb.net numericupdown control

Posted on 2009-05-12
2
558 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 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