title: vb.net The dilemma of my design of a datagridview
body: <p>I am using vb.net. I have a datagridview to show data. Since the datagridview needs a filter function, I have an underlying data table of datagridview and filter the view of data table:</p>
  
  <pre><code>     PassFilter(m_table,"Price&gt;0")
      Private Sub PassFilter(ByRef dataTable As DataTable, ByVal strFilter As String)     Try
          Dim dataview As New DataView(dataTable)
          dataview.RowFilter = strFilter
          'DGVTable is my datagridview
          DGVTable.DataSource = dataview
  End Sub
  </code></pre>
  
  <p>This works well. But I have troubles in the following code:</p>
  
  <pre><code>      Private Sub UpdateTable()
        Dim row as dataRow=m_table.NewRow
        row("column1")=GetText()
        m_table.Rows.Add(row)
        End Sub
  </code></pre>
  
  <p>Note that GetText() seems be run on a different thread which returns value after the above codes for the first time.(I am not clear why this happens, but it seems that the second time to call GetText, it can get the value directly) This means that the column1 in m_table is actually empty after the above code for the first time, so datagridview is also empty since its datasource is m_table. I have no choice but to call the above sub again to update datagridview. This is inefficient.</p>
  
  <p>The problem is I want to keep filter simple, then the underlying table seems necessary. But the table does not have invalidate as controls. So table cannot update values. I must call my sub again to update the table.</p>
  
  <p>How can I keep filter simple as well as use datagridview.invalidate to update values so that my sub does not need to be called again?
  Any help is apprecaited.</p>