0
嗨,大家好,我正在编写一个应用程序,它检索从foreach循环中填充的每个NT组的组名和访问权限。另外,我还包含了一个DataGridView控件,其中每个单元格都有一个复选框列,应用程序将相应地检查每个单元格,例如每个组的读,写,修改等。我不能为我的生活,找出如何相应地检查这些盒子。下面的代码片段演示了我正在尝试使用标准的DataGridView控件文本框列,但是我想让这些复选框而不是文本框。任何反馈将不胜感激。在下面的代码片段中,Property是从另一个方法传入的路径。DataGridView复选框问题
private void CheckDirPermissions(ResultProperty Property)
{
if (Property.Type == typeof(string) && !Property.IsArray)
{
try
{
FileSecurity folderSecurity = File.GetAccessControl(Property.String);
foreach (FileSystemAccessRule fileSystemAccessRule in folderSecurity.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount)))
{
string IdentityReference = fileSystemAccessRule.IdentityReference.ToString();
string AccessControlType = fileSystemAccessRule.AccessControlType.ToString();
string filesystemrights = fileSystemAccessRule.FileSystemRights.ToString();
string IsInherited = fileSystemAccessRule.IsInherited.ToString();
DataGridDirPermissions.Rows.Add(IdentityReference,
filesystemrights,
AccessControlType,
IsInherited);
}
}
catch (Exception)
{
MessageBox.Show("Path does not exist.", "Path Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else return;
}
这完美的作品。非常感谢Alexphi – Sanch01R 2009-12-30 14:22:18