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

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,094 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,109 questions
Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,261 questions
Windows Network
Windows Network
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Network: A group of devices that communicate either wirelessly or via a physical connection.
623 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Viorel 110.7K 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,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
    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