Solved

How to parse without the dollar sign

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

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 63

Expert Comment

by:Fernando Soto
ID: 17788723
Not a problem, glad I was able to help. ;=)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML - Color not displaying correctly in EMAIL. 6 55
.NET 2008 VB and C# 6 48
Create a datatable in vb.net dynamically 1 39
Optimize the query 5 51
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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