|
From: WonderMan on 2 Apr 2008 12:07 Hello, I am trying to use a MaskEdBox control to display a percentage value (12,34% by example) and let the user input a new percentage value in the same field. I tried the following setting for the MaskEdBox : Format = "Percent" as indicated in the following page : http://msdn2.microsoft.com/en-us/library/y006s0cz(VS.80).aspx Percent : Displays number multiplied by 100 with a percent sign (%) appended immediately to the right; always displays two digits to the right of the decimal separator. But when I try to set the field to "" or "0,00%" for initialisation MyField.Text = "0,00%" MyField.Text = Format("0","Percent") MyField.Text = "" I always get an "Invalid Property value". Can somebody tell me how to set any numeric value to the MaskEdBox using the "Percent" format ? My PC is running with French settings, and the app is supposed to run in Lebanon, so the solution has to be independent of Windows Country Settings. Thank you very much !
From: Mike Williams on 2 Apr 2008 14:05 On 2 Apr, 17:07, WonderMan <n...(a)none.com> wrote: > I am trying to use a MaskEdBox control to > display a percentage value (12,34% by example) Try: Private Sub Form_Load() MaskEdBox1.Mask = "##.##%" End Sub Private Sub MaskEdBox1_LostFocus() MaskEdBox1.Text = Replace(MaskEdBox1.Text, "_", "0") End Sub Mike
From: WonderMan on 3 Apr 2008 10:53 Mike Williams a pr�sent� l'�nonc� suivant : > On 2 Apr, 17:07, WonderMan <n...(a)none.com> wrote: > >> I am trying to use a MaskEdBox control to >> display a percentage value (12,34% by example) > > Try: > > Private Sub Form_Load() > MaskEdBox1.Mask = "##.##%" > End Sub > > Private Sub MaskEdBox1_LostFocus() > MaskEdBox1.Text = Replace(MaskEdBox1.Text, "_", "0") > End Sub > > > Mike Thank your for your answer. I finally managed the problem in the following way : - Using ########0.00% as MaskEDBox mask (to get always at least 1 figure before the decimal point, and 2 fichures after) - Using the FormatPercent() function in the following way : MaskEDBox.text = FormatPercent(val(strValue)/100,2)
|
Pages: 1 Prev: Problem with MaskEdBox mask and settings Next: Problem with decimal point and Country Settings |