I don't think it's a difficult problem. but I just cannot find / google the answer. Please help.
Basically, my app helps the users to find a list of words (from a bunch of files), and the list of lists of files containing these words.
Say I have:
public class WordInfo
{
public string Word { get; set; }
public List<string> Files { get; set; }
}
And I have also created BindingList<WordInfo>
from List<WordInfo>
, and bound BindingList<WordInfo>
as DataGridView.DataSource
I just don't know how to display WordInfo.Files
with DataGridViewComboBoxColumn
in DataGridView
.
I googled a lot, it seems that I have to set:
DataGridViewComboBoxColumn cbxColumn = dgvWordList.Columns["Files"] as DataGridViewComboBoxColumn;
cbxColumn.DataSource = ??????; // How to get this data source from BindingList<WordInfo>
cbxColumn.DisplayMemeber = "DisplayMemeber"; // Can I have an example?
cbxColumn.ValueMember = "ValueMember"; // Can I have an example?
But I don't know how to set these properties. I googled, but the examples are too complicated.
Please help. thanks.
I think I have some problems understanding DataGridViewComboBoxColumn
, and MSDN documentation has driven me crazy.
Peter