본문 바로가기
컴퓨터/C#

DataGridView 줄 추가하기

by Begi 2022. 6. 24.
반응형

DataGridView에서 줄을 추가하는 방법은 다음과 같다.

 

    DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0].Clone();
    row.HeaderCell.Value = "R1";
    row.Cells[0].Value = "A";
    row.Cells[1].Value = "B";
    row.Cells[2].Value = "C";
    dataGridView1.Rows.Add(row);

 

DataGridView

 

dataGridView1.Rows.Add(row)를 실행하면 새줄이 계속 추가된다.

 

 

반응형

'컴퓨터 > C#' 카테고리의 다른 글

C# TCP Client (TcpClient 사용)  (0) 2022.10.04
DataGridView 컨텍스트 메뉴  (0) 2022.06.25
DataGridView 셀 컬러 변경  (0) 2022.06.24
C# 마이크 입력 실시간 처리  (0) 2022.06.20
C# NAudio 라이브러리 설치  (0) 2022.06.20

댓글