According to documentation, the new controls seem to be DataGridView and DataGridViewTextBoxColumn.
DataGridTextBoxColumn in .Net 5
Hi, We are migrating our prpject to .Net 5
DataGridTextBoxColumn is deprecated in >Net 5 .Can anybody please tell me that what is the corresponding of that .Net 5
2 answers
Sort by: Most helpful
-
-
Karen Payne MVP 35,011 Reputation points
2021-04-01T13:00:29.647+00:00 If open to an alternate way to work with a DataGridView continue.
A consideration would be to use a BindingSource and BindingList (I use a custom BindingList) which means less interaction with the DataGridView except for events.
To work with changes, subscribe to ListChanged event of the BindingList as shown here which is done with Entity Framework (better than working with DataSet/DataTable containers).
If this might be of interest I have a good deal of code samples found here.
One example which auto saves changes
For working with DataSet/DataTable see the following examples. That example also shows working with a DataGridViewComboBox as well as this code sample.
Last but not least, create your own custom columns e.g.
public class DataGridViewUpperCaseTextBoxColumn : DataGridViewTextBoxColumn { public DataGridViewUpperCaseTextBoxColumn() : base() { CellTemplate = new DataGridViewUpperCaseTextBoxCell(); } public sealed override DataGridViewCell CellTemplate { get => base.CellTemplate; set => base.CellTemplate = value; } } public class DataGridViewUpperCaseTextBoxCell : DataGridViewTextBoxCell { public DataGridViewUpperCaseTextBoxCell() : base() { } public override Type EditType => typeof(DataGridViewUpperCaseTextBoxEditingControl); } public class DataGridViewUpperCaseTextBoxEditingControl : DataGridViewTextBoxEditingControl { public DataGridViewUpperCaseTextBoxEditingControl() : base() { CharacterCasing = CharacterCasing.Upper; } }