Hi,
I checked the code.
It is working fine.
Here is a sample that I have re-written.
Dim sFileName As String = "C:\test.txt"
Dim syndict As New Dictionary(Of String, String)
Dim sr As StreamReader = New StreamReader(sFileName)
Dim sInputLine As String = sr.ReadLine()
Do Until sInputLine Is Nothing
If (sInputLine <> "") Then
Dim sites As String() = Nothing
sites = sInputLine.Split(":")
If (syndict.ContainsKey(sites(0))) Then
syndict.Item(sites(0)) = syndict.Item(sites(0)) + "," + sites(1)
Else
syndict.Add(sites(0), sites(1))
End If
End If
sInputLine = sr.ReadLine()
Loop
sr.Close()
End Sub
Kindly let know if this is solving your issue.
Or else specify where exactly this object not initialized exception is shown.
If necessary you can add check for the splitted string array(sites) before accessing it by index or catch exception for that.
Also make sure that each line has only one ':'.Otherwise you may get unexpected results.