使用txt文件登录vb [英] making a login for vb using txt file

查看:86
本文介绍了使用txt文件登录vb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Imports System.IO Public Class loginscreen Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim objstreamreader As StreamReader Dim strline As String objstreamreader = New StreamReader("C:\Users\josh\Documents\computing project/user.txt.txt") strline = objstreamreader.ReadLine() Do While Not strline Is Nothing If String.Equals(strline, TextBox1.text) And String.Equals(strline, TextBox2.text) Then strline = objstreamreader.ReadLine MsgBox("correct") Exit Do Else MsgBox("incorrect login details") End If Loop objstreamreader.Close() End Sub End Class

我正在使用2个文本框进行登录,需要读取文件.这条路绝对是我保存它的方式是正确的.但是,每当我运行代码时,我得到的都是msgbox错误的登录详细信息.我该如何解决?我也认为我的txt文件可以格式化

I'm making a login using 2 textboxes and need to read a file. the pathway is definitely correct its the way I saved it. however whenever I run the code all I get is the msgbox incorrect login details. how do I fix this? also I think my txt file could be formatted incorrectly how do I need my txt file to be set up?

推荐答案

我不知道,正斜杠对我来说似乎不正确" C:\ Users \ josh \ Documents \ computing project / user.txt.txt".另外,您使用文件扩展名 两次,文件名为"user.txt.txt";可能应该是"user.txt"代替.

I don't know, the forward slash looks fishy to me "C:\Users\josh\Documents\computing project/user.txt.txt". Plus you use the file extension twice with the file name "user.txt.txt" which maybe should be "user.txt" instead.

此外,这基本上是

Plus this is basically double post of https://social.msdn.microsoft.com/Forums/en-US/1821ed20-1b95-446d-861e-ccacf2acaff1/creating-a-login-screen-with-vb-using-a-txt-file?forum=vbgeneral.


这篇关于使用txt文件登录vb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆