datagridview not updating on screen RRS feed

  • Question

  • I am working on a Powershell script which has a tab control containing a datagridview that is not bound to anything (i.e. database).  The user checks some checkbox columns in the datagridview, selects an Apply button, then I compute some data and update the checked rows in the table programmatically.  The datagridview consists of 3 columns and n rows. Colum 0 is checkbox, column 1 is a name and column 2 is a state.

       I can update the appropriate cell with the command:

    $dgvList.Rows[$row].Cells[$STATE_INDEX].value = $newState

    However, the screen does not update with the new state.  I have tried several variations the following:





    Nothing, seems to work.  I have no bound datasource, so I don't need to tweak that.  Clearing all the rows in the table and adding them back in does work to a lesser degree, but feels very inefficient and I lose any selected rows the user may have checked. As it stands, I am still losing any rows that have been checked.

    Appreciate, any insight

    Tuesday, April 2, 2013 10:23 PM


  • Hi MaureenCinMass,

    This forum discuss Winform in Net. For Powershell script, you might get better support in other forum.

    Best Regards,

    Bob Wu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 8, 2013 8:40 AM
  •  I guess I was overthinking the problem, because I got it to work by using

          $dgvList.Rows[$row].Cells[$SOME_COLUMN_INDEX].Value = $someValue      

    Tuesday, June 18, 2013 9:09 PM

All replies