Solved

How to parse without the dollar sign

Posted on 2006-10-20
3
261 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

19 Experts available now in Live!

Get 1:1 Help Now