[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

Change formatted values to non-formatted in VB prior saving

I have a VB6 app that saves a series of numeric values formatted on screen as "x,xxx.xx".  For example "2,222.00"  (2 decimal points and comma separator)

How can take out the format from the value previously saving it DB.  That is, if a value is "2,222.00", I want to change it to 2222 or "5.50" change it to 5.5.

In SQL, the columns are formatted as [money]

0
rayluvs
Asked:
rayluvs
  • 5
  • 3
1 Solution
 
RPCITCommented:
what variable type are you storing those values in?  if you are storing them in a string, then you will probably need to convert them to a numeric type.
0
 
rayluvsAuthor Commented:
The fields on screen are TextBox.

How do I convert them to numeric type?
0
 
RPCITCommented:
try ...

Dim s As String
s = "$120.15"
Dim cc As Currency
cc = CCur(s)

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
rayluvsAuthor Commented:
Seems that I have to have those lines for every field I'll save; there's over 100 fields.

Is there another way to save the value non-formatted (without the commas, $, etc.)
0
 
rayluvsAuthor Commented:
I also notice that a variable defined as Currency, when passing a value formatted, it stays woth that format
0
 
rayluvsAuthor Commented:
I think I got it.  I just added CCur("variable") right in the "update" line.  Didn;t have to use any other line per variables

What u think?
0
 
RPCITCommented:
that should work... my example multiple lines to give you context.
0
 
rayluvsAuthor Commented:
Thanx
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now