troubleshooting Question

Migrating VBA Macro Syntax to VB.Net

Avatar of chokka
chokkaFlag for United States of America asked on
Visual Basic Classic.NET ProgrammingVisual Basic.NET
2 Comments1 Solution560 ViewsLast Modified:
Below function splits comma values stored in a string variable. And also splits Currency value such as $1,000.00 by considering as one value. Original version of the code is written in VBA Macro which i am trying to convert to VB.Net.

I don't know to migrate only this piece of VBA Syntax

strRecord = Left(strRecord, intIndex - 1) & strTemp & Mid(strRecord, intPosEnd)

Complete VB.Net Syntax.

Dim strRecord As String
        Dim intIndex As Integer
        Dim intPosComma As Integer
        Dim intPosEnd As Integer
        Dim strTemp As String

        strRecord = " 1,1, " & "$1,182,100.58" & " ," & "$1,182.58" & " "

        For intIndex = 1 To Len(strRecord)
            If Mid(strRecord, intIndex, 1) = "$" Then
                intPosEnd = InStr(intIndex, strRecord, ".")
                strTemp = Mid(strRecord, intIndex, intPosEnd - intIndex)
                strTemp = Replace(strTemp, ",", "|")
                MessageBox.Show(strTemp)

                Dim strTemp2 As String

                strTemp2 = strRecord.Substring(1, intIndex - 1)

                MessageBox.Show(strTemp2)
                'strRecord = Left(strRecord, intIndex - 1) & strTemp & Mid(strRecord, intPosEnd)

            End If
        Next
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros