Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27153

VS 2010 Just a quick explanation

$
0
0
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)

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


Viewing all articles
Browse latest Browse all 27153

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>