If e.FolderName = "/" OrElse e.FolderName = "/公共" OrElse e.FolderName = "/" & User.Name Then
每个用户可能访问自己的目录,所有用户都能访问名为“公共”以及根目录,如果符合此条件就不需要做任何处理
ElseIf User.Group = "经理" Then
不符合上面的添加,就会进来这里,再判断是否是经理,如果是,也不做任何处理,因为“如果用户分组为经理,则能访问所有用户的目录”
Else
上面的条件都不符合,就进来这里,既然不符合条件就取消访问
e.Cancel = True
上面的用法等同于下面用法,如果实在不理解就用下面的用法吧
If e.FolderName <> "/" andalso e.FolderName <> "/公共" andalso e.FolderName <> "/" & User.Name andalso User.Group <> "经理" Then
e.Cancel = True
MessageBox.Show("你无权访问他人目录!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
end if