Solved

How to parse without the dollar sign

Posted on 2006-10-20
3
269 Views
Last Modified: 2012-06-27
Hi,
I am trying to parse a data to a database using .csv file which works fine.
But I have one slight problem - how can I remove a $ sign to parse just a number and not the whole thing.

Record ID   Customer Name  Amount     Account No  
  1        ABG                    20.00       025621            
  2              RLP                     17.50       525122    

Thanks!


 Public Sub ParseFile()

    directory = "\\**\***\MyFolder\"

    FileName = "File" & theDate & ".csv"

    thefile = directory & FileName

   Try

       Dim dataline As String()
       Dim delimiter As String = ","
 
       Dim parser As TextFieldParser

            parser = My.Computer.FileSystem.OpenTextFieldParser(thefile)

            parser.Delimiters = New String() {","}

      While Not parser.EndOfData

      dataline = parser.ReadFields()

      Customer_Name = dataline(0)

      Amount = dataline(1)

      Account_No = dataline(2)

    If Account_No <> "ACCOUNT_NO" Then

       EnterData()

    Else

     'skip the line and go to the next line of data

    End If

 End While

      parser.Close()

      MsgBox("Process Complete.")

        Catch ex As Exception
            MsgBox(ex)
            Exit Sub

        End Try

    End Sub
0
Comment
Question by:avi4
  • 2
3 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 17777319
Hi avi4;

Try this

    Amount = dataline(1).Replace("$"c, "")

Fernando
0
 

Author Comment

by:avi4
ID: 17788426
Thanks a lot!
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 17788723
Not a problem, glad I was able to help. ;=)
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

Suggested Solutions

Title # Comments Views Activity
Limiting string to two deciamls 18 49
Javascript Refresh Parent Page from Popup 3 48
Close word object 13 38
Populating an array of locale_time_info 8 37
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

929 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

12 Experts available now in Live!

Get 1:1 Help Now