I have a DataGrid with a DataGridViewComboBoxColumn column, but I want to pass it to the DataGridViewTextBoxColumn column type, so I do the following
if (miDataTable.Rows.Count > 0);
{
// elimina la columna de un data grid
dgvCitas.Columns.Remove("pCita");
// crea una columna
var column = new DataGridViewTextBoxColumn();
column.Name = "pCita";
column.HeaderText = "Cita #1";
//agrega una columna al data grid
dgvCitas.Columns.Insert(2, column);
}
The problem is that this code is within a cycle and every time I delete the column and I create a new one deleting the same data as I may have, so I take care to help me do something similar to this (It should be mentioned that the following code does not work, syntax error) .
if (miDataTable.Rows.Count > 0 && dgvCitas.Columns[numCita].ValueType.ToString()="DataGridViewComboBoxColumn") ;
{
\ mi codigo
}
That is to say, I take care that they help me to compare the type of column that it is, because if it is of texbox type it should not enter the if