数组边界不能出现在类型说明符中/我无法弄明白

时间:2015-07-17 01:10:54

标签: vb.net

 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

1 个答案:

答案 0 :(得分:1)

您在变量声明中缺少New关键字。没有它,您就无法创建类的实例。例如:

Dim username As New System.IO.StreamWriter("...")
'               ^^^