title: Visual Basic Add Row Function Not Working After Reset Function
body: <p>I will clarify my question. Here is background:</p>
  <p>Creating a Database in Visual Studio 2019 using Visual Basic
  Database consists of a list of Devices and Serial Numbers etc. that I must have account of
  I have search functions, filtering functions, and a few editing functions</p>
  <p>The problem I am encountering is that once I click the reset button (supposed to reset the dataviewgrid unsaved changes back to last saved changes) the add row function no longer works. The code throws no error but simply refuses to add a new row when clicking the button (Before hitting the reset button the add row button works fine)</p>
  <p>Here is how I populate my database using sql:</p>
  <pre><code>Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      Dim connection As New SqlConnection(&quot;Connection String Placeholder&quot;)
      Dim Table As New DataTable()
      Dim Adapter As New SqlDataAdapter(&quot;SELECT * FROM TrackMain$&quot;, connection)
      Adapter.Fill(Table)
      DataGridView1.DataSource = Table
  
      bind_data()
      nextId = Convert.ToInt32(dt.Rows(dt.Rows.Count - 1)(0)) + 1
  
  End Sub
  </code></pre>
  <p>I am also attempting to order my first column numerically and therefore I have the NextID value there as well and in my add row function (which may be the culprit)</p>
  <p>Here is the add row and then reset function:</p>
  <pre><code>Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
      Dim dr As DataRow = dt.NewRow()
      dr(0) = nextId
      dt.Rows.Add(dr)
      nextId += 1
  
  End Sub
  
  Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
      Dim connection As New SqlConnection(&quot;Connection String Placeholder&quot;)
      Dim Table As New DataTable()
      Dim Adapter As New SqlDataAdapter(&quot;SELECT * FROM TrackMain$&quot;, connection)
      Adapter.Fill(Table)
      DataGridView1.DataSource = Table
      nextId = Convert.ToInt32(dt.Rows(dt.Rows.Count - 1)(0)) + 1
  End Sub
  </code></pre>
  <p>If any further questions please let me know, and thank you</p>
  <p>Edit: Here is my bind_data() Sub</p>
  <pre><code>Private Sub bind_data()
      connection.Open()
      Dim cmdTxt As String = &quot;SELECT * FROM TrackMain$&quot;
      da = New SqlDataAdapter(New SqlCommand(cmdTxt, connection))
      Dim builder As SqlCommandBuilder = New SqlCommandBuilder(da)
      da.Fill(dt)
      Dim source As BindingSource = New BindingSource With {
                                  .DataSource = dt
                                }
      DataGridView1.DataSource = source
  
  End Sub
  </code></pre>