C#/winform

[DataGridView]클릭한 데이터 텍스트박스로 가져오기

ㅋㅋ! 2021. 2. 26. 17:07

DataGridView의 이벤트에서 CellClick 이벤트를 생성한 뒤, 아래코드를 사용한다.

 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            textBox2.Text=dataGridView1.Rows[this.dataGridView1.CurrentCellAddress.Y].Cells[0].Value.ToString();
        }

 

결과