validate currency

dec21st

Active member
Joined
May 14, 2005
Messages
43
Programming Experience
3-5
as mention above.. how do i validate a textbox to accept currency?

i can't seem to find it to work .... i've seen ppl using instr and double.tryparse.

can anyone be kind enough to explain wht those 2 thing does?
 
if you want a number displayed in currency format use FormatCurrency()

so you can have a person enter a number into the textbox then in the lostfocus event you can format it for currency:

VB.NET:
Private Sub Textbox1_LostFocus (...) Handles Textbox1.LostFocus
  Textbox1.Text = FormatCurrency(Textbox1.Text)
End Sub

as far as checking a string to see if it's in currency format you can use Mid() so see if the first character is a "$" and there's at least 1 period with no letters (only numbers)

also the IsNumeric() function is your friend for checking to see if something is a number or not as well
 
i don't wanna put the $ sign in my text box
basically i just wanna validate the textbox to accept value like

23.98 or 1999.50
 
Back
Top