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