   MSVS 8, VB "NullReferenceException"
  Ok, I know that I am supposed to set my variables to new values, but I have been working on this for hours trying to get it to allow me to set my value for the string. I am used to VB 6 and the migration to the 2005 edition has been fine so far until this. Here's my code:Public URLs As String()    Public Sub LoadData()   Dim LineIn As String, CIndex As Integer   LineIn = Nothing : CIndex = 0   Microsoft.VisualBasic.FileOpen(1, "Data\URLS.WWD", OpenMode.Input, OpenAccess.Read)   While Not EOF(1)  LineIn = Microsoft.VisualBasic.FileSystem.LineInput(1)  If InStr(LineIn, "URL=", CompareMethod.Text) = 1 Then URLs(CIndex) = Mid(LineIn, 5, LineIn.Length - 4)  End If  CIndex = CIndex + 1   End While   Microsoft.VisualBasic.FileClose(1)    End SubNow, the error is on the line URLs(CIndex) = Mid(LineIn, 5, LineIn.Length - 4). Why after all this time can't I get it to work? I even followed the MSDN directions here. Help?   
  Try:Public URLs() as String;  Same error.   ;  Oops.AddReDim Preserve URLs(CIndex)just before the line where you get the error.You might also want to move the increment of CIndex inside the if statement. Otherwise, you will have some blank elements in your resulting array for lines that did not have "URL=" in them.;  All lines will have URL= in them. It will be a file that just stores a bunch of URLs for later use. That worked, thanks.   