求助:怎样逐行读取TXT文件,并把一部份分别添加到combo中?
有一个txt文件,格式如一:
wang123,wang123456
wang124,wang123456
wang125,wang12456
…………
现在想把这个文件中的每行读出来,并把每一行,号前面的放到combo中,小弟求源码
Open "c:\username.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, str '按行读取
aa = Split(str, ",")
Combo1.AddItem aa(0)
ReDim aa(0 To 1)
aa = ""
Loop
Close #1
这个代码不对,哪位指导一下
[解决办法]
Dim aa() As StringOpen "c:\username.txt" For Input As #1Do While Not EOF(1) Line Input #1, str '按行读取 aa = Split(str, ",") Combo1.AddItem aa(0) Erase aaLoopClose #1