What i am trying to do here is to replace words with others and add it to the listbox after all the strings have been replaced (if they are in the dictionary)
The error i am getting is "Object Reference not set to an instance of an object"
Public Sub PopulateFixDictionary()
Public Sub Fixer()
I really hope someone can help me
The error i am getting is "Object Reference not set to an instance of an object"
Public Sub PopulateFixDictionary()
Code:
Public Sub PopulateFixDictionary()
fixDictionary = New Dictionary(Of String, String())
Dim words = My.Resources.words
For Each Str As String In words.Split(",")
fixDictionary.Add(Str, Nothing)
Next
End Sub
Code:
Public Sub Fixer()
Try
lst_after.Items.Clear()
Dim di As New IO.DirectoryInfo(My.Settings.path)
Dim aryFi As IO.FileInfo() = di.GetFiles(FileExt)
Dim fi As IO.FileInfo
Dim fs As IO.FileInfo
For Each fi In aryFi
Dim f2 As String
Dim f3 As String
f2 = fi.Name
For Each fixWord As String In fixDictionary.Keys
If (f2.Contains(fixWord)) Then
Dim value As Integer = fixDictionary.Item(fixWord).Length
Dim replacement As String = fixDictionary.Item(fixWord)(value)
f3 = Replace(f2, fixWord, replacement)
lst_after.Items.Add(f3)
End If
Next
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
I really hope someone can help me