I found this code while watching the videos learnnowonline.
Im just a little confused about this part:
Where does ProductsRow come from? I've searched the example I have and cant seem to find it.
Dim productsRow As NorthwindDataSet.ProductsRow = _
CType(CType(ProductsBindingSource.List(e.RowIndex), _
DataRowView).Row(), NorthwindDataSet.ProductsRow)
Im just a little confused about this part:
Where does ProductsRow come from? I've searched the example I have and cant seem to find it.
Dim productsRow As NorthwindDataSet.ProductsRow = _
CType(CType(ProductsBindingSource.List(e.RowIndex), _
DataRowView).Row(), NorthwindDataSet.ProductsRow)
Code:
Private Sub ProductsDataGridView_CellFormatting( _
ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) _
Handles ProductsDataGridView.CellFormatting
Dim productsRow As NorthwindDataSet.ProductsRow = _
CType(CType(ProductsBindingSource.List(e.RowIndex), _
DataRowView).Row(), NorthwindDataSet.ProductsRow)
If ProductsDataGridView.Columns( _
e.ColumnIndex).DataPropertyName = _
"UnitsInStock" Then
If Convert.ToInt32(e.Value) < 10 And _
productsRow.Discontinued = False Then
e.CellStyle.BackColor = Color.Red
End If
End If
If productsRow.Discontinued = True Then
e.CellStyle.BackColor = Color.Goldenrod
End If
End Sub