Note that there are some explanatory texts on larger screens.

plurals
  1. POOnly the last row is displaying on my DataGridView
    text
    copied!<p>The following code is a method that I am calling every time I want to add a row to my tableDocTypes DataGridView. The debug shows that the RowCount is incrementing correctly and all the data passed is correct but once the form displays it only shows the last row. Also the last row that displays is in the row that should be white space so I can't add any new rows since there is no blank cell next to the star. My guess is that I shouldn’t be using tableDocTypes.RowCount - 1 as an index but it appears to be incrementing correctly and I can't find anything else to use. Any information would be helpful. </p> <pre><code>private void addRowToDocTypeTable(bool docTypeValid, string formName, string formCabinet, string docType) { tableDocTypes.Rows.Add(); if (!docTypeValid) { // Change color to yellow and display IndexWarning icons tableDocTypes.Rows[tableDocTypes.RowCount - 1].Cells[columnDocTypeImage.Index].Value = Properties.Resources.IndexWarning; tableDocTypes.Rows[tableDocTypes.RowCount - 1].Cells[columnDocType.Index].Style.BackColor = Color.LightGoldenrodYellow; } else { // Index is good so display IndexCorrect and leave line white tableDocTypes.Rows[tableDocTypes.RowCount - 1].Cells[columnDocTypeImage.Index].Value = Properties.Resources.IndexCorrect; } tableDocTypes.Rows[tableDocTypes.RowCount - 1].Cells[columnFormName.Index].Value = formName; tableDocTypes.Rows[tableDocTypes.RowCount - 1].Cells[columnFormCabinet.Index].Value = formCabinet; tableDocTypes.Rows[tableDocTypes.RowCount - 1].Cells[columnDocType.Index].Value = docType; // Assign the rename menue to only the image column tableDocTypes.Rows[tableDocTypes.RowCount - 1].Cells[columnDocTypeImage.Index].ContextMenuStrip = menuDocTypeEdit; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload