411 REFERENCE · Wikibooks
Visual Basic .NET/DataGridView
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
DataGridView
To change the cell formatting based on content, handle the CellFormatting event. Other methods (e.g. setting the RowDefaultCellStyle) can lose the formatting if the user clicks on a column header to sort the grid.
To link other controls to the grid, use the SelectionChanged event. The RowEnter event can give the wrong behaviour, as it only fires when the focus box enters a row. Again, sorting by clicking on a column header can cause unpredictable behaviour.
To retrieve a DataRow from a databound grid, use: DirectCast(mydatagridview.Rows(i).DataBoundItem, DataRowView).Row
See Also
dotnetperls.com datagridview VB.NET
dotnetperls.com datagridview C#