G
Grant Merwitz
Hi
I have the following struct:
public struct UserFolderNamePair
{
public UserFolderNamePair(string folder, User user)
{
Folder = folder;
ThisUser = user
}
public string Folder;
public User ThisUser;
}
(User is an object I have created)
Now i have an Array of this struct:
UserFolderNamePair[] userFolderNamePair = new UserFolderNamePair[3];
userFolderNamePair[0] = new UserFolderNamePair("Folder1", new
User([email protected]));
userFolderNamePair[1] = new UserFolderNamePair("Folder2", new
User([email protected]));
userFolderNamePair[2] = new UserFolderNamePair("Folder3", new
User([email protected]));
I now want to bind this to my DataGridView.
The DataGridView binds without a problem, and even has the correct amount of
rows.
But i cannot get the Properties of the User object out - or event the
FolderName in the struct for that matter.
I am creating a DataGridViewTextBoxColumn like this:
DataGridViewTextBoxColumn UserId = new DataGridViewTextBoxColumn();
UserId.Name = "UserId";
UserId.DataPropertyName = "UserId";
And like this
DataGridViewTextBoxColumn UserId = new DataGridViewTextBoxColumn();
UserId.Name = "UserId";
UserId.DataPropertyName = "userFolderNamePair.ThisUser.UserId";
None of which are working.
Can i do this?, if so, how should i alter it to get the right details out.
AutoGenerateColumns also brought me no luck.
When i bind this to an Array of object User, this worked perfectly
Help ... TIA
I have the following struct:
public struct UserFolderNamePair
{
public UserFolderNamePair(string folder, User user)
{
Folder = folder;
ThisUser = user
}
public string Folder;
public User ThisUser;
}
(User is an object I have created)
Now i have an Array of this struct:
UserFolderNamePair[] userFolderNamePair = new UserFolderNamePair[3];
userFolderNamePair[0] = new UserFolderNamePair("Folder1", new
User([email protected]));
userFolderNamePair[1] = new UserFolderNamePair("Folder2", new
User([email protected]));
userFolderNamePair[2] = new UserFolderNamePair("Folder3", new
User([email protected]));
I now want to bind this to my DataGridView.
The DataGridView binds without a problem, and even has the correct amount of
rows.
But i cannot get the Properties of the User object out - or event the
FolderName in the struct for that matter.
I am creating a DataGridViewTextBoxColumn like this:
DataGridViewTextBoxColumn UserId = new DataGridViewTextBoxColumn();
UserId.Name = "UserId";
UserId.DataPropertyName = "UserId";
And like this
DataGridViewTextBoxColumn UserId = new DataGridViewTextBoxColumn();
UserId.Name = "UserId";
UserId.DataPropertyName = "userFolderNamePair.ThisUser.UserId";
None of which are working.
Can i do this?, if so, how should i alter it to get the right details out.
AutoGenerateColumns also brought me no luck.
When i bind this to an Array of object User, this worked perfectly
Help ... TIA