title: Query Datagridview and output to Datagridview vb.net
body: <p>I just want to make sure I am reading microsoft's documentation correctly, and that I understand the structure appropriately. </p>
  
  <p>First here is link I am reading:</p>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/bb669099(v=vs.110).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/bb669099(v=vs.110).aspx</a></p>
  
  <p>Second here is the code they suggested:</p>
  
  <pre><code>' Create a table from the bound view representing a query of 
  ' available products.
  Dim view As DataView = CType(bindingSource1.DataSource, DataView)
  Dim productsTable As DataTable = CType(view.Table, DataTable)
  
  ' Set RowStateFilter to display the current rows.
  view.RowStateFilter = DataViewRowState.CurrentRows
  
  ' Query the DataView for red colored products ordered by list price.
  Dim productQuery = From rowView As DataRowView In view _
                     Where rowView.Row.Field(Of String)("Color") = "Red" _
                     Order By rowView.Row.Field(Of Decimal)("ListPrice") _
                     Select New With {.Name = rowView.Row.Field(Of String)("Name"), _
                                  .Color = rowView.Row.Field(Of String)("Color"), _
                                  .Price = rowView.Row.Field(Of Decimal)("ListPrice")}
  
  ' Bind the query results to another DataGridView.
  dataGridView2.DataSource = productQuery.ToList()
  </code></pre>
  
  <p>Sorry if this seems like a dumb question, but my inquiry is mainly related to understanding how to query it appropriately. The "SELECT" part of this code is at the end, correct? (i.e. Select New With, column_name, column_name etc etc). Sorry to put it in SQL terms but I was wondering if it was more efficient to query a datagridview (kind of using it like a temporary table for a query) than having to either reach back out to DB or loop through contents to check for so and so variable.</p>
  
  <p>And is "bindingSource1" the first datagridview, or the source data (table in db)? </p>