Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 抓取用户:单独获取密码_Vb.net - Fatal编程技术网

Vb.net 抓取用户:单独获取密码

Vb.net 抓取用户:单独获取密码,vb.net,Vb.net,我将登录信息文件从.txt导入TextBox1,然后,我想做的是使用这些登录信息登录到网站。所以,我需要一行一行地抓住它们;结构是这样的“user:password” 我怎样才能只抓取“用户”,然后只抓取“密码”,忽略“:” 提前谢谢 Dim Lines as String() = System.IO.File.ReadAllLines("path\to\file") For Each Line as String in Lines Dim Credentials as String()

我将登录信息文件从.txt导入TextBox1,然后,我想做的是使用这些登录信息登录到网站。所以,我需要一行一行地抓住它们;结构是这样的“user:password”

我怎样才能只抓取“用户”,然后只抓取“密码”,忽略“:”

提前谢谢

Dim Lines as String() = System.IO.File.ReadAllLines("path\to\file")
For Each Line as String in Lines
    Dim Credentials as String() = String.Split(Line,":",2)
    ' User will be Credentials(0), Password will be Credentials(1)
    ' Insert code to attempt login
End For

不需要额外的文本框。

谢谢您的帮助,请问我将在哪里编写此代码?对不起,我完全是新手,这取决于你。我建议将其放在按钮或其他可交互控件后面(如果您正在制作Windows窗体应用程序)。如果愿意,还可以将当前尝试的用户名和密码输出到窗口。