Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

International Seperator 2

Status
Not open for further replies.

jajinder

Technical User
Mar 11, 2004
88
NL
Hi,

In Holland (and other countries ofcourse) we use the "," to seperate the decimals in stead of the "." (1.000,00)

Have me a textbox where users can add a value using the ",". Now they want to use the "." to have the same "value" as the ","

Example: When I type 10.0 then it should be 10,0

In Excel-VBA I had this code to do so in a UserForm, ofcourse this does not work in VB.

Private Sub tbMaand_KeyUp( _
ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)

Dim strCompare As String
On Error Resume Next

If tbMonth = vbNullString Then Exit Sub

strCompare = tbMonth.Value

If KeyCode = 110 Or KeyCode = 190 Then
strCompare = Left(strCompare, Len(strCompare) - 1) & International(xlDecimalSeperator)
tbMaand.Value = strCompare
End If
End Sub

Does someone know how to do this? Searched the net without result. Please be patient.. newbee.

---------------------------------------
This will be the day when all of God’s children will be able to sing with a new meaning, “My country, ‘tis of thee, sweet land of liberty, of thee I sing. Land where my fathers died, land of the pilgrim’s pride, from every mountainside, let freedom ring. - Marten Luther King
 
Sean,

I changeg the keypress code as follwing:

Code:
Private Sub Textbox10_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
   
   Dim strIn As String
   Dim sDecSep  As String
    
   sDecSep = LoadLocaleValue(LOCALE_SDECIMAL)
   strIn = Chr(KeyAscii)
    
   If strIn = "." Or strIn = "," Then
      KeyAscii = Asc(sDecSep)
   End If
   
End Sub
And now it works fine!

I can't thank you enough!!

You really saved my day!!

Thanks!!

-Episode80
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top