Re: Dispose of dictionary
Show some code of how your assigning these variables and the dictionary.. maybe there's something not quite right there...
Re: Dispose of dictionary
Have you tried DictionaryObject.Clear before the call to Dispose it?
Re: Dispose of dictionary
Thanks for the replies!
If I try to clear then dispose it exits the app and that is not what I am trying to do......
The code that I am using to create the dict is pretty straightforward.
Code:
'Open File
Private Sub btnOpen_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnOpen.Click
If c4wFile.ShowDialog() = Windows.Forms.DialogResult.OK Then
srFileReader = System.IO.File.OpenText(c4wFile.FileName)
strLast = srFileReader.ReadLine()
Do Until strLast = ""
SplitSTR = Split(strLast, "|")
lbxName.Items.Add(SplitSTR(0))
dict.Add(SplitSTR(0), SplitSTR(1))
strLast = srFileReader.ReadLine()
Loop
srFileReader.Close()
srFileReader.Dispose()
End If
End Sub
I am just having a problem closing the file for some reason.