title: Auto refresh DataGridView after update
body: <p>I want to get auto refresh Datagridview after update </p>
  
  <pre><code>Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      Dim CON As SqlConnection
  
      CON = New SqlConnection("Data Source=.;Initial Catalog=PantienDatabase;Integrated Security=True")
      CON.Open()
      Try
          cmd = New SqlCommand
          cmd.Connection = CON
          cmd.CommandText = "UPDATE Patient_Detail SET Name ='" &amp; TextBoxName.Text &amp; "',Age = '" &amp; TextBoxAge.Text &amp; "',Sex = '" &amp; TextBoxSex.Text &amp; "',Address = '" &amp; TextBoxAddress.Text &amp; "',Check_In = '" &amp; TextBoxCHiN.Text &amp; "',Check_In_Illness = '" &amp; TextBoxCHinL.Text &amp; "',Sevice = '" &amp; TextBoxService.Text &amp; "',Check_out_Illness = '" &amp; TextBoxCHoutL.Text &amp; "',Check_out = '" &amp; TextBoxCHout.Text &amp; "',Transfer = '" &amp; TextBoxTransfer.Text &amp; "',Patient_result = '" &amp; ComboBoxPtr.Text &amp; "' WHERE ID = '" &amp; TextBoxid.Text &amp; "' "
          //'cmd.CommandText = "UPDATE Patient_Detail SET Name = @Name, Age = @Age, Sex = @Sex, Address = @Address, Check_In = @Check_In, Check_In_Illness =@Check_in_illness, Sevice =@Service, Check_out_Illness =@Check_out_Illness, Check_out = @Check_out ,Transfer = @Transfer, Patient_result = @Pantient_result WHERE ID = @ID '
  
          cmd.ExecuteNonQuery()
          DataGridView1.Refresh()
      Catch ex As Exception
          MessageBox.Show(ex.Message)
      End Try
  End Sub
  </code></pre>