0
private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
{
    string sid;
    try
    {
        txtOut.Clear();
        sid = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells["ServerType"].Value.ToString();
        txtOut.Text = sid;
        txtOut.Refresh();
    }
    catch(Exception)
    {
    }

    List<string> lst2 = new List<string> ();
    DataGridView dgv1 = new DataGridView();

    //load dgv1 with the rows
    foreach(DataGridViewRow r in dataGridView1.SelectedRows)
    {
        dgv1.Rows.Add(r);

        string scolumn = r.DataGridView.Columns.Equals(3).ToString();
        txtOut.Text = r.ToString();
        txtOut.Refresh();
    }

    string[] q1 = lst2.Distinct().ToArray();
    listBox1.DataSource = q1;
}
4

0 に答える 0