从字符串转换为long类型在vb.net中无效错误

时间:2013-01-08 08:30:52

标签: directory vb.net-2010

限制特定用户访问文件夹。使用vb.net.In变量传递用户名和密码。但在那一行我得到的错误就像上面提到的那样。变量mailid和pwd包含一些像xx和yy的值

code
----
Dim FolderPath As String = "D:\ABC\2011\TAccount\HA\" 'Specify the folder here
Dim UserAccount As String = mailid \ pwd

 Dim FolderInfo As IO.DirectoryInfo = New IO.DirectoryInfo(FolderPath)
 Dim FolderAcl As New DirectorySecurity
 FolderAcl.AddAccessRule(New FileSystemAccessRule(UserAccount, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit Or InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Deny))

 FolderInfo.SetAccessControl(FolderAcl)

1 个答案:

答案 0 :(得分:0)

尝试将您的行更改为以下内容........

Dim UserAccount As String = mailid & "\" &  pwd

基本上我可以理解它将你的字符串声明作为SUM并尝试DIVIDE mailid BY pwd因此它认为它是一个字符串并试图将其转换为数字。