VB 读取 TXT一段文字的下一行
我的TXT文件内容:梦幻龙族http:\\ml.playcool.com\17173http:\\www.17173.com\___我用一个listbox显示了TXT里面...
我的TXT文件内容:
梦幻龙族
http:\\ml.playcool.com\
17173
http:\\www.17173.com\
___
我用一个listbox 显示了TXT里面的 梦幻龙族 和 17173
如果我点一下listbox 里的梦幻龙族或者17173,能不能实现msgbox对应下一行的网址?(求代码)
不会问问题,谢谢各位大虾! 展开
梦幻龙族
http:\\ml.playcool.com\
17173
http:\\www.17173.com\
___
我用一个listbox 显示了TXT里面的 梦幻龙族 和 17173
如果我点一下listbox 里的梦幻龙族或者17173,能不能实现msgbox对应下一行的网址?(求代码)
不会问问题,谢谢各位大虾! 展开
1个回答
展开全部
'调用方法: getvalue "17173"
'or 按照你的: getvalue list1.text
Private Sub GetValue(Find As String)
on error resume next
Dim a As Long, b As String, c() As String
a = FreeFile
Open "c:\a.txt" For Binary As #a '读取txt文件
b = Space$(LOF(a))
Get #a, , b
Close #a
c() = Split(b, vbCrLf)
For i = LBound(c) To UBound(c)
if lcase(c(i))=lcase(find) then Msgbox c(i+1):exit for
Next i
End Sub
'or 按照你的: getvalue list1.text
Private Sub GetValue(Find As String)
on error resume next
Dim a As Long, b As String, c() As String
a = FreeFile
Open "c:\a.txt" For Binary As #a '读取txt文件
b = Space$(LOF(a))
Get #a, , b
Close #a
c() = Split(b, vbCrLf)
For i = LBound(c) To UBound(c)
if lcase(c(i))=lcase(find) then Msgbox c(i+1):exit for
Next i
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询