Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If My.Computer.FileSystem.DirectoryExists("C:\ACCOUNTS\") = True Then
Else
End If
If TextBox1.Text = "" Then
Label1.Text = "Error, More than one character requried."
Else
End If
If TextBox2.Text = "" Then
Label1.Text = "Error, Please Insert A Password."
Else
MkDir("C:\ACCOUNTS\" + TextBox1.Text)
Dim username As System.IO.StreamWriter("C:\ACCOUNTS\" + TextBox1.Text + "\" + "username.txt")
username.Write(TextBox1.Text)
username.close()
Dim password As System.IO.StreamWriter("C:\ACCOUNTS\" + TextBox1.Text + "\" + "password.txt")
password.Write(TextBox2.Text)
password.close()
Label1.Text = "Account is Verified."
End If
End Sub
End Class
答案 0 :(得分:1)
您在变量声明中缺少New
关键字。没有它,您就无法创建类的实例。例如:
Dim username As New System.IO.StreamWriter("...")
' ^^^