Solved

VB.Net - How to Work With Array Contents

Posted on 2014-02-19
2
276 Views
Last Modified: 2014-02-19
Good Day Experts!

I am trying to figure out the best way to iterate through an Array, manipulate the data and then either save it in place or to a new Array.

I have parsed off the string of a Delete query after the Where.  So, for example I would have "Customer = '123' And Order = 'abc'"

Then I run the following code to split it apart on the And:
                    Dim ValueArray() As String
                    ValueArray = qryString.Split(":")

The Array contains:
                     Customer = '123'
                     Order = 'abc'  

I am intersted in stripping off all data before/including the = and getting rid of the single quotes leaving:
                      123
                      abc

I would then need the data back in the original array or a new one.

What is the best way you all can suggest to achieve this?

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 39871059
Try something like:
        Dim qryString As String = "Customer = '123' And Order = 'abc'"
        Dim ValueArray() As String = qryString.Split("And")
        For i As Integer = 0 To ValueArray.Length - 1
            If ValueArray(i).IndexOf("=") <> -1 Then
                ValueArray(i) = ValueArray(i).Split("=")(1).Trim
            End If
            ValueArray(i) = ValueArray(i).Trim("'")
            Debug.Print(i & " = " & ValueArray(i))
        Next

Open in new window

0
 

Author Comment

by:Jimbo99999
ID: 39871596
Thanks for the help...it works great! I like the split on = I didn't think of that.
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
Clone Visual studio 2013 solution 5 25
Help with distributing .NET Framework with Clickonce technology 2 30
vb.net 2 37
Web Form VB.Net  import CSV 4 27
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

867 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

22 Experts available now in Live!

Get 1:1 Help Now