Solved

vb.net numericupdown control

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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display

738 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