【发布时间】:2012-01-23 23:54:46
【问题描述】:
我想将逗号分隔的文本文件 (PracInfo.txt) 的内容添加到 Form_Load 上的字典中。文件内容如下:
wlvc,coadmin
mrmd,thadmin
ccoa,oaadmin
bfhl,bfadmin
trty,tradmin
nppp,npadmin
例如,我希望 wlvc 为键,coadmin 为对应的值。我到目前为止的代码如下:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim sr As New StreamReader("C:\Programming files\PracInfo.txt")
Dim openWith As New Dictionary(Of String, String)
Do While sr.Peek <> -1
strHold = sr.ReadLine()
' here I would like to use the String.Split method on strHold and then put that into the Dictionary using Dictionary.Add(Key,Value) but not sure how to do this????
Loop
End Sub
End Class
在此问题上的任何帮助将不胜感激!谢谢
【问题讨论】:
标签: vb.net string dictionary