Ok this is probably really easy but i cant seem to get an array of mine to populate.

array Code:
  1. Private Sub ButtonGenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGenerate.Click
  2.  
  3.         Dim counter As Integer = 0
  4.         If TextBox4.Text = TextBox3.Text And TextBox4.Text = TextBox2.Text And TextBox4.Text = TextBox1.Text Then
  5.             Dim OldName, NewName, Folder As String
  6.             Dim logCount As Integer = 0
  7.             Dim TrueFalse As Boolean
  8.             StartDir = TextBoxDir.Text
  9.             'Variables for writing text log
  10.             Dim LogArray() As String
  11.             Dim FileWriter As StreamWriter
  12.             Dim LogFile As String = StartDir & "LogFile.txt"
  13.             'Loop to change names and make log
  14.             For counter = 0 To ArrayLengthGlobal - 1 Step 1
  15.                 'Need Logic To skip files that can not be found.  Need to make a log when Skips.  
  16.                 'Have box 1 show log of files skiped
  17.                 'Have box 2 Show completed message
  18.                 OldName = StartDir & "\" & Lines2(counter) & "\" & Lines3(counter) & "\" & Lines1(counter)
  19.                 NewName = Lines4(counter)
  20.                 Folder = StartDir & "\" & Lines2(counter) & "\" & Lines3(counter)
  21.                 TrueFalse = My.Computer.FileSystem.FileExists(OldName)
  22.                 If TrueFalse Then
  23.  
  24.                     My.Computer.FileSystem.RenameFile(OldName, NewName)
  25.                 Else
  26.                     LogArray(logCount) = OldName
  27.                     logCount = logCount + 1
  28.                 End If
  29.             Next
  30.             FileWriter = New StreamWriter(LogFile, False)
  31.             For counter1 = 0 To logCount Step 1
  32.                 FileWriter.Write(LogArray(counter1))
  33.             Next
  34.             FileWriter.Close()
  35.             'Dim LogString() As String = LogArray
  36.             'TextBoxOldNameDir.Text = LogString()
  37.             TextBoxNewNameDir.Text = "Complete!"
  38.         Else
  39.             TextBoxNewNameDir.Text = "Error! Please make sure all files are of same length."
  40.         End If
  41.     End Sub

Whats happening is that LogArray under the else statement is saying Variable 'LogArray' is used before it is assigned a value.

Again I'm new to VB and I'm not to sure what this is trying to do. I thought I assigned LogArray above when I put
logarray Code:
  1. Dim LogArray() As String
In my code.