Avatar of rosy2015
rosy2015

asked on 

Using Constructs with arrays - seq file

Using Constructs with arrays

Dim myFile As New System.IO.StreamReader("H:\Files\myfile.txt")
        Dim i As Integer
        While myFile.Peek() <> -1
            Dim myString As String = myFile.ReadLine()
            Dim obj As String() = myString.Split(","c)
            staffName(i) = obj(0)
            StaffNo(i) = obj(1)
            i = i + 1
        End While

' gives out of bound error, why?
Visual Basic.NET

Avatar of undefined
Last Comment
Bill Prew
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Bill Prew
Bill Prew

Another possibility is that i  is larger than the two arrays indexed by it:

staffName(i)
StaffNo(i)


I don't see i  set before entry into this code either.

I would debug through the code and look at the various arrays and indexes and see where the overflow is.


»bp
Visual Basic.NET
Visual Basic.NET

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,

96K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo