c# - WinForms setup DataGridView with one column bound to List -
i'm using c# 4.0 , winforms. i'm trying datagridview setup this
[checkbox] [textcolumn] [comboboxcolumn]
this menu similar sql server import/export tool. checkbox tell me whether table transferred. textcolumn source table name. , comboboxcolumn list of tables in destination database.
example
[transfer] [sourcetable] [destinationtable] x mytablesource mytabledest
where mytabledest list choose (tablea, tableb, tablec), or input own name.
i tried this.datagridview.datasource = mybindinglist mybindinglist has custom object looks like
public class mine { public bool transfer { get; set;} public string source { get; set;} public list<string> destination { get; set; } }
i don't need full solution - direction on how achieve this
the mine class isn't holding list of destinations, single destination, class should this:
public class mine { public bool transfer { get; set; } public string source { get; set; } public string destination { get; set; } }
then using datagridview control has 3 columns specified, quick example running:
column1.datapropertyname = "transfer"; column2.datapropertyname = "source"; column3.datapropertyname = "destination"; column3.datasource = new list<string>() { "aaa", "bbb", "ccc" }; list<mine> grid = new list<mine>(); grid.add(new mine() { transfer = true, source = "xxx", destination = "bbb" }); grid.add(new mine() { transfer = false, source = "yyy", destination = "aaa" }); grid.add(new mine() { transfer = true, source = "zzz", destination = "ccc" }); datagridview1.datasource = grid;
column3 combobox column specify list of options in datasource property of column, list separate class of mine objects.
Comments
Post a Comment