Solved

How to parse without the dollar sign

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
DataGridView Events ? 3 45
Convert an ASPX page into PDF 7 32
No Data for DropDown List 2 22
vb.net and creating a class 5 14
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

813 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

15 Experts available now in Live!

Get 1:1 Help Now