Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to change column type from textbox to button of datagridview using VB.NET

I tried other ways but can not do.

please help me !

Thanks in advance
Posted

1 solution

Bind that datagridview again with the new columns

datagridview1.Columns.Clear();
datagridview1.AutoGenerateColumns = false;
dgvMappedfields.Columns.AddRange
                (
                    new DataGridViewTextBoxColumn
                    {
                        DataPropertyName = "DataPropertyName1",
                        Name = "Name1",
                        HeaderText = "HeaderText1"
                    },
                    new DataGridViewButtonColumn
                    {
                        DataPropertyName = "DataPropertyName2",
                        Name = "Name2",
                        HeaderText = "HeaderText2"
                    }
                );
 
Share this answer
 
Comments
ngthtra 15-Jun-11 22:41pm    
No no, I only want to change current column type

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900