Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > Manipulating Arrays created by Split()


Reply
 
Thread Tools Display Modes
  #1  
Old 02-28-2007, 11:47 AM
lynefitz lynefitz is offline
Newcomer
 
Join Date: Feb 2007
Posts: 4
Default Manipulating Arrays created by Split()


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:

_dataValuesPrimary.length()
_dataValuesPrimary.setValue()
etc...

I'm trying to change the value to certain items in the array. What am I not seeing? =)
Reply With Quote
  #2  
Old 02-28-2007, 12:33 PM
brillo's Avatar
brillo brillo is offline
Junior Contributor
 
Join Date: Jan 2004
Location: San Antonio, Texas
Posts: 203
Default

I added the following to the Form_Load event of my vb.net application and I was able to change the value at index 1.

I guess I do not understand what your issue is.

Code:
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))
__________________
I need an exterminator for all these bugs!

brillo
Reply With Quote
  #3  
Old 02-28-2007, 01:26 PM
lynefitz lynefitz is offline
Newcomer
 
Join Date: Feb 2007
Posts: 4
Default

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 &
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->