title: Populate form with a passed value from another form using visual studio
body: <p>I have one form with a few Datagridviews which are populated with data from different databases (screenshot 1)
  <a href="https://i.stack.imgur.com/8jX9C.jpg" rel="nofollow noreferrer">enter image description here</a>
  When I right click a new form pops up which I want to populate with all the data from the row that is selected (screenshot 2)
  <a href="https://i.stack.imgur.com/tT7Yg.jpg" rel="nofollow noreferrer">enter image description here</a>
  In my code I hard coded the number 1376 to see if it works. If I replace the number 1376 with ValuePass it won't work. So I need a way to pass that value somehow. It did the same thing for a piece of string which works but it does not seem to work for the value.</p>
  
  <p>So this is what I got so far in my first Form</p>
  
  <pre><code>Public Class Relatie_beheer
  Public SQL As New SQLControl
  Dim value As Object
  
  Private Sub dvgRelaties_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
      Handles dgvRelaties.CellClick
      If (e.RowIndex = -1 Or e.ColumnIndex = -1) Then Return
  
      ' No matter which cell is clicked, put the data from the field in the relatie_nr column in the variable value
      Dim x As Integer
      x = e.ColumnIndex + (3 - e.ColumnIndex)
      value = dgvRelaties.Rows(e.RowIndex).Cells(x).Value
  End Sub
  
  Private Sub WijzigenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles WijzigenToolStripMenuItem.Click
      Dim Obj As New RelatieNieuw With {
          .StringPass = "Wijzigen"
      }
      Dim ValObj As New RelatieNieuw With {
          .ValuePass = value
      }
      Obj.ShowDialog()
  End Sub
  </code></pre>
  
  <p>And in my second Form</p>
  
  <pre><code>Public Class RelatieNieuw
  Public SQL As New SQLControl
  Public Property StringPass As String
  Public Property ValuePass As String
  
  Private Sub RelatieNieuw_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      Label2.Text = StringPass + " Relatie"
      Select Case StringPass
          Case "Toevoegen"
              ' Open new window and create a new private key number
          Case "Wijzigen"
              ' Open new window and retrieve relatie fields to change
              SQL.AddParam("@item", 1376)
              SQL.ExecQuery("SELECT * FROM relatie WHERE Relatie_nr = @item;")
              txtzoeknaam.Text = SQL.DBDT.Rows(0)(1).ToString
  
          Case "Verwijder"
              ' Open new window and retrieve relatie fields to delete
          Case Else
              MsgBox("Option not defined " + StringPass)
      End Select
  End Sub
  </code></pre>