[VB.Net] DatagridView Problem

Discussion in 'Mixed Languages' started by jcgo16, Apr 22, 2012.

  1. jcgo16

    jcgo16 MDL Junior Member

    Sep 16, 2010
    74
    2
    0
    Im having a problem with datagridview


    i have a timer, 2 rows


    in the timer im updating 2nd row

    i deleted the 1st row, and suddenly it crashed


    this is the code in timer

    DataGridView1.Rows(1).Cells(0).Value = DataGridView1.Rows(1).Cells(0).Value + Counter
     
  2. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    6,223
    22,281
    210
    #2 Alphawaves, Apr 23, 2012
    Last edited by a moderator: Apr 20, 2017
    Did you use any of the following ?
    Code:
    DataGridView1.Invalidate(True)
    DataGridView1.Update()
    Also how are you deleting the row?

    Code:
    For Each item As DataGridViewRow In DataGridView1.SelectedRows
    DataGridView1.Rows.RemoveAt(item.Index)
    Next
    :eek: