Solved

Change Dot for comma vb6

Posted on 2010-09-18
5
735 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

914 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now