0
我有一个Vb应用程序,它将数据保存在我的文档中 我有Console_Load程序,它创建2个TXT文件并验证其他片段代码寻找相同的TXT文件,但当我安装这个应用程序后发布它引发错误的控制台加载“错误:从字符串”C /用户/ mydocument“转换为类型布尔无效”错误:从字符串“C/user/mydocument”转换为类型布尔值无效
以下是代码: -
Dim chkuser As String
Dim chkpass As String
Dim LoadUser As String
Dim LoadPass As String
Dim userexist As Boolean
Dim passexist As Boolean
Dim fullFilePathu As String
Dim fullFilePathp As String
With My.Computer.FileSystem
fullFilePathu = .CombinePath(.SpecialDirectories.MyDocuments, "user.txt")
fullFilePathp = .CombinePath(.SpecialDirectories.MyDocuments, "user.txt")
If fullFilePathp = False Then
My.Computer.FileSystem.WriteAllText(fullFilePathu, String.Empty, False)
My.Computer.FileSystem.WriteAllText(fullFilePathp, String.Empty, False)
End If
chkpass = .CombinePath(.SpecialDirectories.MyDocuments, "pass.txt")
chkuser = .CombinePath(.SpecialDirectories.MyDocuments, "user.txt")
My.Computer.FileSystem.WriteAllText("chkpass", String.Empty, False)
My.Computer.FileSystem.WriteAllText("chkuser", String.Empty, False)
LoadUser = .ReadAllText(chkuser)
LoadPass = .ReadAllText(chkpass)
userexist = My.Computer.FileSystem.FileExists(chkuser)
passexist = My.Computer.FileSystem.FileExists(chkpass)
If userexist = True Then
UserName.Text = LoadUser
PASSWORD.Text = LoadPass
LOGIN.Enabled = False
AutoON.Enabled = False
statusIO.Text = "Logged In"
LOGIN.Enabled = False
LOGOFF.Enabled = True
PS我是新手提前
谢谢
PPS哪一行? – Plutonix
随着My.Computer.FileSystem fullFilePathu = .CombinePath(.SpecialDirectories.MyDocuments, “user.txt”) fullFilePathp = .CombinePath(.SpecialDirectories.MyDocuments, “user.txt”) 如果fullFilePathp = false,那么 我。 Computer.FileSystem.WriteAllText(fullFilePathu,的String.Empty,假) My.Computer.FileSystem.WriteAllText(fullFilePathp,的String.Empty,假) 结束如果 chkpass = .CombinePath(.SpecialDirectories.MyDocuments, “pass.txt” ) chkuser = .CombinePath(.SpecialDirectories.MyDocuments,“user.txt”) –
'fullFilePathp = ...'指定一个字符串。 '如果fullFilePathp = False那么'一个字符串不能为真或假。你想做什么? '用My.Computer.FileSystem'也太不可靠了 – Plutonix