How can I get information from a datagridview to use in another form [duplicate]

0

I'm doing a program in C # and I have a datagridview in Form1 and I have another datagridview in Form2 . How can I get the selected cell from the datagridview that is in Form1 and use it as variable in Form2 or I wanted to use the variable test in another Form

  

This is how I'm going to get the cell values in the datagridview:

    if (dataGridViewEnviarDados.SelectedRows.Count > 0)
    {
     foreach (DataGridViewRow r in dataGridViewEnviarDados.SelectedRows)
     {
      string test = r.Cells[0].Value.ToString()
     }
    }
    
asked by anonymous 31.08.2017 / 17:15

0 answers