Results 1 to 7 of 7

Thread: array length unknown? adding more to an array? [resolved]

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    southwest pennsylvania
    Posts
    65

    array length unknown? adding more to an array? [resolved]

    i dont know how to do things with arrays, please help me

    im using this code:

    Dim sr As StreamReader = File.OpenText("users.txt")
    Dim users()() As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim i As Integer = 0
    Dim x As Integer = 0
    Do While sr.Read
    users(x)(0) = sr.ReadLine
    users(x)(1) = sr.ReadLine
    x += 1
    Loop
    sr.Close()
    End Sub
    Dim sr As StreamReader = File.OpenText("users.txt")
    Dim users()() As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim i As Integer = 0
    Dim x As Integer = 0
    Do While sr.Read
    users(x)(0) = sr.ReadLine
    users(x)(1) = sr.ReadLine
    x += 1
    Loop
    sr.Close()
    End Sub

    im getting this error:

    An unhandled exception of type 'System.NullReferenceException' occurred in first.exe

    Additional information: Object reference not set to an instance of an object.

    can someone plz help me?
    Last edited by joeframbach; Dec 30th, 2002 at 10:06 PM.
    if you choose not to decide you still have made a choice!

    RUSH rocks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width