Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Masked Edit Box

Posted on 2001-07-23
4
Medium Priority
?
229 Views
Last Modified: 2012-05-04
Hi.  
Does anybody know why the MaskEdBox control in VB 6 SP 5 doesn't seem to be locale aware?  I have it
in my app with the format property = $##,0.00;($#,##0.00).  I also use code to set formats such as

label1.caption = formatcurrency(rate.text)

The code works fine - when I change my regional settings and reboot the machine the label reflects the
local currency, date/time, etc formats.  However, the maskedbox control always gives the "$" symbol
rather than the regional currency symbol.  Does anybody know if this is a known issue and/or if there
is a workaround?

Worst case I suppose I could pull the maskedbox controls out and format the textboxes through code.
 Seems strange the folks in Redmond would miss this one...
0
Comment
Question by:jmerritt
[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
4 Comments
 
LVL 18

Expert Comment

by:deighton
ID: 6308371
Private Sub Command1_Click()
MaskEdBox1.Mask = getmask
End Sub

'in a bas module

Option Explicit

Public Type CURRENCYFMT
    NumDigits As Long
    LeadingZero As Long
    Grouping As Long
    lpDecimalSep As String
    lpThousandSep As String
    NegativeOrder As Long
    PositiveOrder As Long
    lpCurrencySymbol As String
End Type
Public Declare Function GetCurrencyFormat Lib "kernel32.dll" Alias "GetCurrencyFormatA" _
    (ByVal Locale As Long, ByVal dwFlags As Long, ByVal lpValue As String, lpFormat _
    As Any, ByVal lpCurrencyStr As String, ByVal cchCurrency As Long) As Long
Const LOCALE_USER_DEFAULT = &H800
Const LOCALE_SYSTEM_DEFAULT = &H400


Function getmask() As String
Dim cft As CURRENCYFMT     ' custom formatting settings
Dim formatted As String  ' receives the formatted number strings
Dim strlen As Long       ' the length of the formatted string
Dim c As Long

' Display the value formatted according to the current locale.
formatted = Space(256)
strlen = GetCurrencyFormat(LOCALE_SYSTEM_DEFAULT, 0, "1234567.89", ByVal CLng(0), _
    formatted, Len(formatted))
formatted = Left(formatted, strlen)
For c = 1 To Len(formatted)
    getmask = getmask & IIf(IsNumeric(Mid(formatted, c, 1)), "#", Mid(formatted, c, 1))
Next

Debug.Print "User locale format: "; formatted

End Function
0
 
LVL 15

Expert Comment

by:lyonst
ID: 6308373
Hi,

Have you checked your Autoexec.bat or Config.sys files as these values can also be ste there any may overide your regional settings ?

Cheers,

T.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7156370
Hi jmerritt,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.
    *** deighton's code is good, but not on point.

jmerritt, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 7182232
Placed in PAQ

Computer101
E-E Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

604 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