vb从listbox读取数据
vb从listbox读取数据,把类似于122.226.194.170administrator123右击菜单把那一行的ip用户名密码赋值给变量overipoveruser...
vb从listbox读取数据,把类似于122.226.194.170 administrator 123
右击菜单把那一行的ip 用户名 密码 赋值给变量overip overuser overpass 展开
右击菜单把那一行的ip 用户名 密码 赋值给变量overip overuser overpass 展开
1个回答
展开全部
Option Explicit
Dim IP() As String, Admin() As String, Pass() As String
Private Sub Command1_Click()
Dim IPS() As String, j%, I%
Dim IPADPAS As String, AdminPass() As String
I = GetTxtCount(App.Path & "\IP.txt")
ReDim IP(1 To I), Admin(1 To I), Pass(1 To I)
Open App.Path & "\IP.txt" For Input As #1
Do While Not EOF(1)
j = j + 1
Line Input #1, IPADPAS
If IPADPAS <> "" Then
IPS = Split(IPADPAS, ":")
IP(j) = Right((Left(IPS(0), Len(IPS(0)) - 1)), Len(IPS(0)) - 2)
AdminPass = Split(Trim(IPS(1)), " ")
Admin(j) = AdminPass(0)
Pass(j) = IIf(Left(AdminPass(1), 1) = "[", "", AdminPass(1))
End If
Loop
Close #1
For I = 1 To I
List1.AddItem IP(I) & "," & Admin(I) & "," & Pass(I)
Next I
End Sub
Private Function GetTxtCount(sPath As String) As Long
Dim I As Long, V As String
Open sPath For Input As #1
While Not EOF(1)
Line Input #1, V
If V <> "" Then I = I + 1
Wend
Close #1
GetTxtCount = I
End Function
Private Sub LetVal_Click()
Dim overip As String, overuser As String, overpass As String
overip = IP(List1.ListIndex + 1)
overuser = Admin(List1.ListIndex + 1)
overpass = Pass(List1.ListIndex + 1)
Text1 = overip
Text2 = overuser
Text3 = overpass
End Sub
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then PopupMenu Me.Menu
End Sub
Dim IP() As String, Admin() As String, Pass() As String
Private Sub Command1_Click()
Dim IPS() As String, j%, I%
Dim IPADPAS As String, AdminPass() As String
I = GetTxtCount(App.Path & "\IP.txt")
ReDim IP(1 To I), Admin(1 To I), Pass(1 To I)
Open App.Path & "\IP.txt" For Input As #1
Do While Not EOF(1)
j = j + 1
Line Input #1, IPADPAS
If IPADPAS <> "" Then
IPS = Split(IPADPAS, ":")
IP(j) = Right((Left(IPS(0), Len(IPS(0)) - 1)), Len(IPS(0)) - 2)
AdminPass = Split(Trim(IPS(1)), " ")
Admin(j) = AdminPass(0)
Pass(j) = IIf(Left(AdminPass(1), 1) = "[", "", AdminPass(1))
End If
Loop
Close #1
For I = 1 To I
List1.AddItem IP(I) & "," & Admin(I) & "," & Pass(I)
Next I
End Sub
Private Function GetTxtCount(sPath As String) As Long
Dim I As Long, V As String
Open sPath For Input As #1
While Not EOF(1)
Line Input #1, V
If V <> "" Then I = I + 1
Wend
Close #1
GetTxtCount = I
End Function
Private Sub LetVal_Click()
Dim overip As String, overuser As String, overpass As String
overip = IP(List1.ListIndex + 1)
overuser = Admin(List1.ListIndex + 1)
overpass = Pass(List1.ListIndex + 1)
Text1 = overip
Text2 = overuser
Text3 = overpass
End Sub
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then PopupMenu Me.Menu
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询