DataGridTextBoxColumn in .Net 5

MRUTYUNJAYA MAHAPATRA 1 Reputation point
2021-03-30T07:26:58.85+00:00

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

Developer technologies .NET .NET Runtime
Windows for business Windows Client for IT Pros Networking Network connectivity and file sharing
Developer technologies C#
{count} votes

2 answers

Sort by: Most helpful
  1. Viorel 122.6K Reputation points
    2021-03-30T08:21:45.34+00:00

    According to documentation, the new controls seem to be DataGridView and DataGridViewTextBoxColumn.


  2. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    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
    83722-north.png

    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;  
        }  
    }  
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.