Solved

comma function for textbox

Posted on 2006-07-20
3
281 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
Comment Utility
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
Comment Utility
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
Comment Utility
Works on any size input:
? Format(10000000000000000, "##,##0")  
10,000,000,000,000,000
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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.
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…
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…

763 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

10 Experts available now in Live!

Get 1:1 Help Now