Button disappears but the other column members of the row remains visible in datagridview c# -
i writing code make sure if translate button pressed new row appears row members except string text visible..now have written code makes button disappear , members still visible.
this view after button pressed..
now button invisible other members still visible.this code have tried..
private void datagridview1_cellcontentclick(object sender, datagridviewcelleventargs e) { bool ce = false; bool check = true; column_handling(); datagridviewtextboxcell c = new datagridviewtextboxcell(); if(!(datagridview1.rows[e.rowindex].selected)) { datagridview1.rows[e.rowindex].selected = false; if (e.columnindex == 10) { if((convert.toint16(this.datagridview1.rows[e.rowindex].cells[0].value) == convert.toint16(this.datagridview1.rows[e.rowindex + 1].cells[0].value)) && (convert.toint16(this.datagridview1.rows[e.rowindex].cells[1].value) == convert.toint16(this.datagridview1.rows[e.rowindex + 1].cells[1].value))) { ce = true; } if(!ce) { datarow dt = datarows.newrow(); dt[0] = this.datagridview1.currentrow.cells[0].value.tostring(); dt[1] = this.datagridview1.currentrow.cells[1].value.tostring(); dt[2] = this.datagridview1.currentrow.cells[2].value.tostring(); dt[3] = this.datagridview1.currentrow.cells[3].value.tostring(); dt[4] = this.datagridview1.currentrow.cells[4].value.tostring(); dt[5] = this.datagridview1.currentrow.cells[5].value.tostring(); dt[6] = this.datagridview1.currentrow.cells[6].value.tostring(); dt[7] = this.datagridview1.currentrow.cells[7].value.tostring(); dt[8] = this.datagridview1.currentrow.cells[8].value.tostring(); dt[9] = this.datagridview1.currentrow.cells[9].value.tostring(); datarows.rows.insertat(dt, e.rowindex + 1); var row = this.datagridview1.rows[e.rowindex + 1]; datagridviewcolumn column = datagridview1.columns[2]; datagridviewcell cella = new datagridviewtextboxcell(); cella.style.backcolor = color.wheat; column.celltemplate = cella; var cell = new datagridviewtextboxcell(); cell.value = string.empty; var cell1 = new datagridviewtextboxcell(); cell1.value = string.empty; var cell2 = new datagridviewtextboxcell(); cell2.value = string.empty; var cell3 = new datagridviewtextboxcell(); cell3.value = string.empty; var cell4 = new datagridviewtextboxcell(); cell4.value = string.empty; var cell5 = new datagridviewtextboxcell(); cell5.value = string.empty; var cell6 = new datagridviewtextboxcell(); cell6.value = string.empty; var cell7 = new datagridviewtextboxcell(); cell7.value = string.empty; var cell8 = new datagridviewtextboxcell(); cell8.value = string.empty; var cell9 = new datagridviewtextboxcell(); cell9.value = string.empty; var cell10 = new datagridviewtextboxcell(); cell10.value = string.empty; row.cells[10] = cell;//the button column row.cells[0] = cell2; row.cells[1] = cell3; row.cells[3] = cell4; row.cells[4] = cell5; row.cells[5] = cell6; row.cells[6] = cell7; row.cells[7] = cell8; row.cells[8] = cell9; row.cells[9] = cell10; cell.readonly = true; datagridview1.readonly = true; datagridview1.refresh(); } else if (!cao) { datagridview1.rows[e.rowindex + 1].visible = true; var row = this.datagridview1.rows[e.rowindex + 1]; var cell = new datagridviewtextboxcell(); cell.value = string.empty; row.cells[10] = cell; cell.readonly = true; datagridview1.refresh(); cao = true; } else if (ce) { datagridview1.rows[e.rowindex + 1].visible = false; var row = this.datagridview1.rows[e.rowindex + 1]; var cell = new datagridviewtextboxcell(); cell.value = string.empty; row.cells[10] = cell; cell.readonly = true; datagridview1.refresh(); cao= false; } } } }
Comments
Post a Comment