vb.net - Monitoring Datagridview for rows that are being unhidden -
i've got a bit of code allowing results box pop up, populating datagridview
information. datagridview
uses same bindingsource
datagridview
uses, when 1 clicked, other automatically moves same selected cell.
the issue having result_datagridview
doesn't contain of same rows master dgv, hides rows don't match criteria. if user clicks on cell on master dgv isn't present in result dgv, result dgv un-hides row (as can't hide selected row).
i'm trying use method hide row appears again, because of how vb treats "entering cell" fires before cell appears (as fires on input focus, before cell appears in dgv, row never gets checked)
private sub result_datagridview_cellenter(sender object, e datagridviewcelleventargs) handles result_datagridview.cellenter dim result integer dim row integer = 0 result_datagridview.rowcount - 1 = row result = array.find(resultarray, function(x) x = result_datagridview.rows(i).cells(0).value) if result = 0 result_datagridview.rows(i).visible = false end if next end sub
if there ".rowsunhidden" event, work fine.
note - resultarray
contains of index numbers need remain visible, check performed see if rows exist index number not appear in array, if so, hide again.
does have work around or better approach this?
handling rowenter
event, can suspend binding , reset row.visible
false
.
so, if resultarray
integer
array of visible row indices, following:
private sub result_datagridview_rowenter(sender object, e datagridviewcelleventargs) if not resultarray.contains(e.rowindex) dim currencymanager1 currencymanager = directcast(bindingcontext(result_datagridview.datasource), currencymanager) currencymanager1.suspendbinding() result_datagridview.rows(e.rowindex).visible = false currencymanager1.resumebinding() end if end sub
Comments
Post a Comment