|
From: WonderMan on 2 Apr 2008 10:39 Hello, I am working on a VB6 application which includes a MaskEdBox to allow user to input a percentage value. For the moment, it only allows to input entiere data (I mean data with no decimal coma of decimal point, like 10, 22, and so on). I need to allow the user to input values like 22.56 or 33.12 and do on. Can somebody help me with the settings I need to use in the Property Page of the MaskEdBox to obtain a mask like this (2 figures before the decimal coma, and 2 figures after the decimal coma ?) Thank you for your help.
From: WonderMan on 2 Apr 2008 11:17 WonderMan a �crit : > Hello, > > > I am working on a VB6 application which includes a MaskEdBox to allow user to > input a percentage value. > > For the moment, it only allows to input entiere data (I mean data with no > decimal coma of decimal point, like 10, 22, and so on). > > I need to allow the user to input values like 22.56 or 33.12 and do on. > > Can somebody help me with the settings I need to use in the Property Page of > the MaskEdBox to obtain a mask like this (2 figures before the decimal coma, > and 2 figures after the decimal coma ?) > > Thank you for your help. I tried the following : Settings for the control (nammed MyField) : Mask = ##.00 Format = 0 And I tried to use it in the following way : MyField.Text = Format("10", "##.00") But I alway get an error "Invalid property value" ... BTW, the Country Settings of my PC are set for France (if that makes any difference).
From: Jan Hyde (VB MVP) on 2 Apr 2008 11:18 WonderMan <none(a)none.com>'s wild thoughts were released on Wed, 02 Apr 2008 16:39:39 +0200 bearing the following fruit: >Hello, > > >I am working on a VB6 application which includes a MaskEdBox to allow >user to input a percentage value. > >For the moment, it only allows to input entiere data (I mean data with >no decimal coma of decimal point, like 10, 22, and so on). > >I need to allow the user to input values like 22.56 or 33.12 and do on. > >Can somebody help me with the settings I need to use in the Property >Page of the MaskEdBox to obtain a mask like this (2 figures before the >decimal coma, and 2 figures after the decimal coma ?) > >Thank you for your help. Try setting the mask property to ##.## -- Jan Hyde https://mvp.support.microsoft.com/profile/Jan.Hyde
From: WonderMan on 2 Apr 2008 11:24 Jan Hyde (VB MVP) a exprim� avec pr�cision : > WonderMan <none(a)none.com>'s wild thoughts were released on > Wed, 02 Apr 2008 16:39:39 +0200 bearing the following fruit: > >> Hello, >> >> >> I am working on a VB6 application which includes a MaskEdBox to allow >> user to input a percentage value. >> >> For the moment, it only allows to input entiere data (I mean data with >> no decimal coma of decimal point, like 10, 22, and so on). >> >> I need to allow the user to input values like 22.56 or 33.12 and do on. >> >> Can somebody help me with the settings I need to use in the Property >> Page of the MaskEdBox to obtain a mask like this (2 figures before the >> decimal coma, and 2 figures after the decimal coma ?) >> >> Thank you for your help. > > Try setting the mask property to ##.## I tried it and go the same message. It seems that the only way to make it work is using : MyField.Text = Format("10", "##,00") (not the coma, in the format string) as in France we use 12,34 and not 12.34 But I need to make the aaplication international, since it is supposed to work in Lebanon ...
From: Mike Williams on 2 Apr 2008 14:00
On 2 Apr, 16:24, WonderMan <n...(a)none.com> wrote: > > Try setting the mask property to ##.## > I tried it and go the same message. Why not do this: Private Sub Form_Load() MaskEdBox1.Mask = "##.##" End Sub Private Sub MaskEdBox1_LostFocus() MaskEdBox1.Text = Replace(MaskEdBox1.Text, "_", "0") End Sub I've put the Replace function in the LostFocus event just for simplicity, but you can ut it wherever ele suits your purposes. Mike |