Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- html #select #option #multiple
- DatePicker
- mosquitto.conf
- AntDesign
- setInterval 외부 정지
- setInterval 정지
- pm2
- 공인IP
- DataGridView 직접 입력
- pm2 확인
- pm2 설치
- transfer
- pm2 상태 확인
- mosquitto
- setInterval 중지
- invalid data
- map이 undefined가 뜰 때
- c# datagridview 데이터 넣기
- 맥 어드레스
- pm2 시작
- mySQL_Replication
- 데이터테이블 데이터 넣기
- allow_anonymouse
- setInterval clear
- 서버동기화
- listener 1883
- Replication
- 1883
- datagridview 직접입력
- timepicker
Archives
- Today
- Total
개발 노트
C# 예제 그리드뷰 본문
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ex_dataGridView2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SetupDataGridView();
PopulateDataGridView();
}
/*
* SetupDataGridView()
* DataGridView의 기본적인 설정을 합니다.
*/
private void SetupDataGridView()
{
this.Controls.Add(dataGridView1);
// DataGridView의 컬럼 갯수를 5개로 설정합니다.
dataGridView1.ColumnCount = 5;
// DataGridView에 컬럼을 추가합니다.
dataGridView1.Columns[0].Name = "Release Date";
dataGridView1.Columns[1].Name = "Track";
dataGridView1.Columns[2].Name = "Title";
dataGridView1.Columns[3].Name = "Artist";
dataGridView1.Columns[4].Name = "Album";
}
/*
* PopulateDataGridView()
* DataGridView에 데이터를 삽입합니다.
*/
private void PopulateDataGridView()
{
// DataGridView에 삽입할 데이터를 설정합니다.
string[] row0 = { "11/22/1968", "29", "Revolution 9", "Beatles", "The Beatles [White Album]" };
string[] row1 = { "1960", "6", "Fools Rush In", "Frank Sinatra", "Nice 'N' Easy" };
string[] row2 = { "11/11/1971", "1", "One of These Days", "Pink Floyd", "Meddle" };
string[] row3 = { "1988", "7", "Where Is My Mind?", "Pixies", "Surfer Rosa" };
string[] row4 = { "5/1981", "9", "Can't Find My Mind", "Cramps", "Psychedelic Jungle" };
string[] row5 = { "6/10/2003", "13", "Scatterbrain. (As Dead As Leaves.)", "Radiohead", "Hail to the Thief" };
string[] row6 = { "6/30/1992", "3", "Dress", "P J Harvey", "Dry" };
// DataGridView에 한 줄씩 삽입합니다.
dataGridView1.Rows.Add(row0);
dataGridView1.Rows.Add(row1);
dataGridView1.Rows.Add(row2);
dataGridView1.Rows.Add(row3);
dataGridView1.Rows.Add(row4);
dataGridView1.Rows.Add(row5);
dataGridView1.Rows.Add(row6);
// DataGridView에 들어갈 컬럼의 순서를 지정합니다.
dataGridView1.Columns[0].DisplayIndex = 3;
dataGridView1.Columns[1].DisplayIndex = 4;
dataGridView1.Columns[2].DisplayIndex = 0;
dataGridView1.Columns[3].DisplayIndex = 1;
dataGridView1.Columns[4].DisplayIndex = 2;
}
}
}
'프로그래밍 > C#' 카테고리의 다른 글
데이터그리드뷰 csv파일불러오기 (0) | 2022.01.17 |
---|---|
구구단 (0) | 2022.01.17 |
DataGridView에 대해서 알아보자 (0) | 2022.01.17 |
C# 데이터테이블 텍스트박스로 데이터 넣기 (0) | 2022.01.17 |
[C#] DataGridView에 직접 데이터 넣어보기 (0) | 2022.01.17 |