473,789 Members | 2,925 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Characters in a NumericUpDown

Didn't find much documentation on value formatting on a NumericUpDown
control. is it possible to separate numbers by a special character.

For example, If I wanted to display an option to change a person's height in
a NumericUpDown, I would not want them to see 62, I'd want them to see 6'2"
(6-Foot-Two).

Is this even possible?

Thankyou,
Nov 17 '05 #1
2 1275
"ReMEn" <Re***@discussi ons.microsoft.c om> wrote in message
news:FF******** *************** ***********@mic rosoft.com...
Didn't find much documentation on value formatting on a NumericUpDown
control. is it possible to separate numbers by a special character.

For example, If I wanted to display an option to change a person's height in a NumericUpDown, I would not want them to see 62, I'd want them to see 6'2" (6-Foot-Two).


I think the UpDown control only understands integer values ala
Get/SetDlgItemInt. The communication with its 'buddy' is done via WM_GETTEXT
and WM_SETTEXT, so presumably a subclass of the buddy window could
handle/intercept/forward these messages as needed to perform the back and
forth translations.
--
Jeff Partch [VC++ MVP]
Nov 17 '05 #2
ReMEn wrote:
Didn't find much documentation on value formatting on a NumericUpDown
control. is it possible to separate numbers by a special character.

For example, If I wanted to display an option to change a person's height in
a NumericUpDown, I would not want them to see 62, I'd want them to see 6'2"
(6-Foot-Two).

Is this even possible?

Thankyou,


You can make a hiden link.

I mean, you have for example IDC_ED_FEET and IDC_SPIN_FEET linked now,
put one more editbox IDC_ED_FEETINT hidden (unvisible) in the window,
and make a link with IDC_SPIN_FEET. By pussing updown button, it will
actually change the content of IDC_ED_FEETINT, from 61 to 62, then
you capture the EN_CHANGE an update your IDC_ED_FEET to 6'2".
When user edited the string 6'2" to something else, you react to
EN_CHANGE and parse the new value and set the IDC_ED_FEETINT.
I don't know what to do if user edited to be "foobaa" instead of valid
height, then you may change the value to be 0.

Don't forget to make a semafor flag to distinguish user's input or
program code which changed the editbox, to avoid recursive EN_CHANGE events...
muchan
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
9924
by: | last post by:
Hi, I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically? Thanks
0
1940
by: Koert | last post by:
Hi, In the NumericUpDown control I have to detect that Tab was pressed so I have overroden the PreProcessMessage function. In for example the DateTimePicker this works fine but not in the NumericUpDown. The debugger does not stop in the PreProcessMessage function. Is this a bug in the NumericUpDown control? thanks, Koert
10
7146
by: Bonj | last post by:
I'm using a number of NumericUpDown controls on my form, which controls printer settings such as number of pages. However I want to override one of the default behaviours of the control, namely when it is tabbed into (selected), I want the number that is displayed in it to become selected, so the user can just type straight over it. For this I'm using the event handler: private void UpDown_Enter(object sender, System.EventArgs e) {...
0
1437
by: Koert | last post by:
Hi In the NumericUpDown control I have to detect that Tab was pressed so I have inherited the NumericUpDown and overroden the PreProcessMessage function. In the DateTimePicker (for example) this works fine but not in the NumericUpDown. It seams that the debugger does not access the PreProcessMessage function. Is this a bug in the NumericUpDown control? Is there an other way to detect that the Tab was pressed in the control thanks, Koer
3
30174
by: abc my vclass | last post by:
My win-form have many numericupdown controls to applied. But numericupdown control don't like textbox, text box control can automatic selected text when got focus. Is there any method can let me set all numericupdown autoselect text when gotfocus?
4
4691
by: illegal.prime | last post by:
Hey all, I have a NumericUpDown control on a Panel or potentially a Form that have AutoScroll enabled. When the NumericUpDown is active I would like the Form/Panel/whatever not to scroll when I scroll the value in the NumericUpDown. I can add an additional handler to the MouseWheel event on the NumericUpDown, but how do I stop the Form/Panel/Whatever from scrolling when the value is changing in the NumericUpDown?
5
2180
by: Len Weltman | last post by:
I am trying to pass a NumericUpDown object into a class method using Visual Studio 2005, but the control type is not found in Intellisense and the type declaration is flagged as an error. Here is a code sample (which doesn't work): *** Begin code ***
2
2781
by: Stephan Zaubzer | last post by:
Hi all, I encountered a problem with NumericUpDown yesterday and managed to reproduce the error with a very easy examle. I have a Windows Application with only one Form, which contains only one NumericUpDown control and nothing else. This is the only code I wrote: (everything else was done with the designer of Visual Studio).
2
2394
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello experts, I posted a disturbing question in here: http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.dotnet.languages.csharp&mid=dedc665f-91c0-4fa4-a103-a98a6808759c But no one have answered it. Is not clear? or maybe it a Framework bug? Please help.
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.