Hi All,
I have been able to create a successful application with Python but I am being asked to create in VB.
I have a text file with the following data:
1,a
1,b
1,c
2,a
2,a
2,b
3,a
3,c
I need to create a dictionary in VB so that I can then iterate over it so that my key is the first field and my item is the concatenation of unique items for each key in the text file:
In Python I would have:
I am starting with the following in VB:
How do I begin to assign a variable for the key, assign a variable for the items and then add to the dictionary uhdict.
Any help and guidance wher to start is very much appreciated.
Thanks again.
I have been able to create a successful application with Python but I am being asked to create in VB.
I have a text file with the following data:
1,a
1,b
1,c
2,a
2,a
2,b
3,a
3,c
I need to create a dictionary in VB so that I can then iterate over it so that my key is the first field and my item is the concatenation of unique items for each key in the text file:
In Python I would have:
Code:
{1:(a,b,c), 2:(a,b), 3:(a,c)}
Code:
Private Sub ImpFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImpFile.Click Dim uhdict As Dictionary(Of Integer, String) = New Dictionary(Of Integer, String) Dim openimp As New OpenFileDialog() If openimp.ShowDialog() = DialogResult.OK Then Dim sr As New System.IO.StreamReader(openimp.FileName) sr.Close() End If End Sub
Any help and guidance wher to start is very much appreciated.
Thanks again.
Comment