title: How to update selected row in datagridview through textbox located on another form?
body: <p>Hi guys i've been working so far with my system and it's almost done, but there is one thing i can't solve yet(not unless if you help me out).
  so here's my code:</p>
  
  <pre><code>Private Sub btnEditmain_Click(sender As Object, e As EventArgs) Handles btnEditmain.Click
  
      Try
          editdgv()
          Form2.Show()
          DataGridView2.AllowUserToAddRows = True
      Catch ex As Exception
          MsgBox(ex.Message)
      End Try
  End Sub
  </code></pre>
  
  <p>here's the private sub editdgv</p>
  
  <pre><code>Private Sub editdgv()
      Dim i = DataGridView2.CurrentRow.Index
  
      With DataGridView2
          Form2.txtPeriod.Text = IIf(IsDBNull(.Rows(i).Cells("period").Value), " ", .Rows(i).Cells("period").Value)
          Form2.txtVouch.Text = IIf(IsDBNull(.Rows(i).Cells("vouch_amt").Value), " ", .Rows(i).Cells("vouch_amt").Value)
          Form2.txtIndivAmt.Text = IIf(IsDBNull(.Rows(i).Cells("individual_amt").Value), " ", .Rows(i).Cells("individual_amt").Value)
          Form2.txtCheckno.Text = IIf(IsDBNull(.Rows(i).Cells("check_no").Value), " ", .Rows(i).Cells("check_no").Value)
          Form2.txtDmailed.Text = IIf(IsDBNull(.Rows(i).Cells("D_MAILED").Value), " ", .Rows(i).Cells("D_MAILED").Value)
          Form2.txtDirno.Text = IIf(IsDBNull(.Rows(i).Cells("DIR_NO").Value), " ", .Rows(i).Cells("DIR_NO").Value)
          Form2.txtYrlvl.Text = IIf(IsDBNull(.Rows(i).Cells("year_student").Value), " ", .Rows(i).Cells("year_student").Value)
          Form2.txtUpdatedBy.Text = IIf(IsDBNull(.Rows(i).Cells("who_updated").Value), " ", .Rows(i).Cells("who_updated").Value)
      End With
  End Sub
  </code></pre>
  
  <p>i was able to pass the value of the selected rows in datagridview to another form(textbox)
  all things are working fine from there..</p>
  
  <p>Now what i wanna do is to update that selected datagridview which is now in my textbox(s).
  through a button click.</p>
  
  <p>now i'm stuck at saving changes that i've done in the textbox, so it will be updated on the database.</p>
  
  <p>pls help me on how to update the selected row in datagridview in textbox via button click.
  thanks!</p>
  
  <pre><code>Public Class Form2
  
  Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
  
  End Sub
  
  End Class
  </code></pre>