title: how to refresh my datagridview after I add new data
body: <p>I'm having a lot of trouble finding ways to refresh my datagridview.. I've tried datagridview.refresh(), datagridview.Update()....but it doesn't work...</p>
  
  <p>here's my code</p>
  
  <pre><code>Imports System.Data
  Imports System.Data.OleDb
  Imports System.Data.Odbc
  Imports System.Data.DataTable
  Public Class Form1
  
  Dim provider As String
  Dim dataFile As String
  Dim connString As String
  Dim addstring As String
  Dim cnn As OleDbConnection = New OleDbConnection
  Dim ds As DataSet = New DataSet
  Dim da As OleDbDataAdapter
  Dim tables As DataTableCollection = ds.Tables
  Dim cmd As New OleDb.OleDbCommand
  Dim dr As System.Data.OleDb.OleDbDataReader
  
  
  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  
      t_date.Text = Today
      provider = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="
      dataFile = "C:\Users\hp-2\Documents\Visual Studio 2012\Projects\Delta\Delta.mdb"
  
      connString = provider &amp; dataFile
      cnn.ConnectionString = connString
      da = New OleDbDataAdapter("Select Customer_Name, Job, Amount from [Transaction] where Trans_date = Date()", cnn)
      da.Fill(ds, "Transaction")
  
      Dim view1 As New DataView(tables(0))
      Dim source1 As New BindingSource()
      source1.DataSource = view1
      showdata.DataSource = view1
      showdata.Refresh()
      cnn.Close()
  End Sub
  </code></pre>
  
  <p>I've tried this one but it doesn't work too.</p>
  
  <pre><code>Private Sub showdat()
      If Not cnn.State = ConnectionState.Open Then
          cnn.Open()
      End If
      showdata.Refresh()
      cnn.Close()
  End Sub
  </code></pre>
  
  <p>...</p>
  
  <pre><code>Private Sub btmclose_Click(sender As Object, e As EventArgs) Handles btmclose.Click
      Me.Close()
  End Sub
  
  Private Sub C_job_SelectedIndexChanged(sender As Object, e As EventArgs) Handles C_job.SelectedIndexChanged
      Dim selected As String = C_job.SelectedItem.ToString()
      If selected = "Internet" Then
          t_amount.Text = "20"
          php.Visible = True
      ElseIf selected = "Games" Then
          t_amount.Text = "10"
          php.Visible = True
      ElseIf selected = "Print (short)" Then
          t_amount.Text = "1"
          php.Visible = True
      ElseIf selected = "Print (long)" Then
          t_amount.Text = "2"
          php.Visible = True
      ElseIf t_amount.Text = "" Then
          php.Visible = False
      End If
  End Sub
  </code></pre>
  
  <p>here is my ADD button... after i've click it...the data is successfully added but the datagridview doesn't refresh...</p>
  
  <pre><code>Private Sub btnadd_Click(sender As Object, e As EventArgs) Handles btnadd.Click
  
      provider = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
      dataFile = "C:\Users\hp-2\Documents\Visual Studio 2012\Projects\Delta\Delta.mdb"
  
      connString = provider &amp; dataFile
      cnn.ConnectionString = connString
      cnn.Open()
  
      cmd.Connection = cnn
  
      cmd.CommandText = "insert into [Transaction] (Customer_Name, Job, Trans_date, Amount ) " &amp; _
          " values ('" &amp; C_name.Text &amp; "','" &amp; C_job.Text &amp; "','" &amp; t_date.Text &amp; "','" &amp; t_amount.Text &amp; "')"
      cmd.ExecuteNonQuery()
  
      showdat()
  
      cnn.Close()
  End Sub
  
  End Class
  </code></pre>