Manipulating Arrays created by Split()

02-28-2007, 11:47 AM
Can someone tell me what I'm not seeing? I'm writing this using Microsoft Visual Basic .NET

I'm reading from a comma delimited file: 0,343,Hello,XXX

Dim _data As String
Dim _dataValuesPrimary As String()

_data = _vendorReader.Readline()

_dataValuesPrimary = Split(_data, ",")
(->splits the line into an array of strings each of which holds an item so _dataValuesPrimary(1) is 343)

What is not working is any of the methods associated with that array:


I'm trying to change the value to certain items in the array. What am I not seeing? =)

02-28-2007, 12:33 PM
I added the following to the Form_Load event of my application and I was able to change the value at index 1.

I guess I do not understand what your issue is.

Dim _data As String
Dim _dataValuesPrimary As String()

_data = "0,343,Hello,XXX"

_dataValuesPrimary = Split(_data,",")

MsgBox("Legth=" & _dataValuesPrimary.Length())

_dataValuesPrimary.SetValue("300", 1)

MsgBox("Index 0=" & _dataValuesPrimary(1))

02-28-2007, 01:26 PM
I tried that with the following changes: instead of MsgBox I used Log.WriteEntry to write to the event viewer. It doesn't log the first Log.Write statement, nothing prints and the application hangs.

Dim _data5 As String
Dim _dataValuesPrimary5 As String()

_data5 = "0,343,Hello,XXX"

_dataValuesPrimary = Split(_data5, ",")

Log.WriteEntry("Legth=" & _dataValuesPrimary5.Length())

_dataValuesPrimary5.SetValue("300", 1)

Log.WriteEntry("Index 0=" & _dataValuesPrimary5(1))

I've also tried Log.WriteEntry using the + instead of the &

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum