https://stackoverflow.com/questions/10285488/datagridview-multiple-row-selection-specific-column-data-get
For Each row As DataGridViewRow In dataGridView_UnAssodevices.SelectedRows
Dim dr As New DataGridViewRow
Dim data As New DataGridViewTextBoxCell
data.Value = row.Cells(0).Value
dr.Cells.Add(data)
dt.Rows.Add(dr)
MessageBox.Show(data.ToString)
Next
For Each SelectedRow As DataGridViewRow In dgv02.SelectedRows
If dgv02.Rows.Count > 0 Then
Dim value As String = (SelectedRow.Cells(11).Value.ToString)
Dim b As String
b = CStr(TextBox3.Text)
open_database()
cmd = New SqlCommand
cmd.Connection = cn
sql = "update in_stock1 set location='" & b & "'"
cmd.CommandText = sql
cmd.ExecuteNonQuery()
End If
Next
For Each sr As DataGridViewRow In dgv02.SelectedRows
If sr.Selected = True Then
Dim va1 As String = sr.Cells(1).Value.ToString
Dim b As String
b = CStr(TextBox3.Text)
open_database()
cmd = New SqlCommand
cmd.Connection = cn
cmd.CommandText = "update in_stock1 set location='" & b & "' where product_id='" & va1 & "'"
cmd.ExecuteNonQuery()
End If
Next