I've done this in vb.net, but can't seem to get it to work in c#
. I'm trying to set the datatype
of a new datacolumn
to Label (or System.Windows.Forms.Label) so that this datatable can have references to controls on the form for faster indexing. Code snippet:
DataColumn dc = new DataColumn {DataType = System.Windows.Forms.Label, ColumnName = "labelDate"};
is throwing error "'Label' is a type, which is not valid in the given context". Meanwhile, "DataType" requires "Type", so I'm not sure what's wrong here.
Figured it out, leaving the answer here in case it's helpful to anyone
DataColumn dc = new DataColumn {DataType = typeof(Label), ColumnName = "labelDate"};