Solved

VB.Net - How to Work With Array Contents

Posted on 2014-02-19
2
275 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 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

21 Experts available now in Live!

Get 1:1 Help Now