Solved

Change Dot for comma vb6

Posted on 2010-09-18
5
737 Views
Last Modified: 2012-08-13
Hello all,

I would like to know what i could do, only in one textbox, that if somedoby pless on the Dot "." , it put a comma automatically ","

How can i do this please?

Thanks for your help
0
Comment
Question by:Wilder1626
5 Comments
 
LVL 9

Expert Comment

by:TonyReba
ID: 33708549
can you post a part of the code so we can take a look ?
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 33708569
Sure

Private Sub txtCout_unitaire_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
txtCout_unitaire.Text = Format(txtCout_unitaire.Text, "Currency")
End Sub
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 33708910
Try this:
Private Sub txtCout_unitaire_KeyPress(KeyAscii As Integer)

    If KeyAscii <> 46 Then
        KeyAscii = Asc(UCase(Chr(KeyAscii)))
    Else
        KeyAscii = 44
    End If
    txtCout_unitaire.Text = Format(txtCout_unitaire.Text, "Currency")

End Sub

Open in new window

0
 
LVL 22

Accepted Solution

by:
danaseaman earned 500 total points
ID: 33710213
Or just:

Private Sub Text1_KeyPress(KeyAscii As Integer)
   If KeyAscii = 46 Then
      KeyAscii = 44
   End If
End Sub

Open in new window

0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 33711387
That is perfect.

Thanks a lot for your help
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

810 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