Link to home
Create AccountLog in
Avatar of savache27
savache27

asked on

Need to remove space from negative value

Hi,

I have a program where a user types in an amount. It works fine, but if they type in a negative value and leave a space in between the negative and the number it blows up. Ex. - 12.94 instead of -12.94.

Is there a way that I can remove, or replace that space. This is my code, and I need it for the txtAmt.text:

 While dtr.Read()
            txtyear.Text = dtr("phone_year") & ""
            txtmonth.Text = dtr("phone_month") & ""
            txtEmployee.Text = dtr("Employee") & ""
            txtNumber.Text = dtr("PhoneNumber") & ""
            txtAccount.Text = dtr("FunctionalAccount") & ""
            txtAmt.Text = dtr("phone_amount") & ""
        End While

I tried to do it like this:

 Dim vAmt = Replace(Trim(txtAmt.Text), "' '", "")
vAmt = dtr("phone_amount") & ""

But I think that the trim removes spaces before and after, not within the text.  If anyone could help me out or lead me in the right direction I would really appreciate it. Thank you.
ASKER CERTIFIED SOLUTION
Avatar of YZlat
YZlat
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of savache27
savache27

ASKER

Thank you so much! I really do appreciate your help.