Solved

comma function for textbox

Posted on 2006-07-20
3
283 Views
Last Modified: 2010-05-18
Hi,

Please assist how can we create a sub that will change the data inside a textbox to place a comma, like how the currency works?

i.e.
Text1.Text=350000
CommaText(Text1.Text,True)

Result:
Text1.Text=350,000

CommaText(textbox name, True to place comma or False to remove comma)

Thanks.
0
Comment
Question by:RyanBank
3 Comments
 
LVL 15

Accepted Solution

by:
cquinn earned 450 total points
ID: 17146795
Function CommaText(sValue as string, bToggle as boolean) as String

if bToggle then
  CommaText=Format(sValue, "##,##0")  
else
  CommaText=Format(sValue, "####0")  
end if

End Function
0
 

Author Comment

by:RyanBank
ID: 17146831
Will that also work if the value was more than a thousand? 1,000,000
0
 
LVL 9

Assisted Solution

by:dancebert
dancebert earned 50 total points
ID: 17147014
Works on any size input:
? Format(10000000000000000, "##,##0")  
10,000,000,000,000,000
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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

948 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

22 Experts available now in Live!

Get 1:1 Help Now