C#
C# 개발 - Devexpress Gridcontrol 사용하여 데이터 출력하기
이준호
2023. 6. 12. 16:10
반응형
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid;
namespace dddeeevvv
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
GridControl gridControl = new GridControl
{
Parent = this,
Dock=DockStyle.Fill,
DataSource=DataHelper.dataList
};
}
}
public class Product
{
public string No { get; set; }
public string Name { get; set; }
public string Price { get; set; }
public string Region { get; set; }
public string Shop { get; set; }
public Product()
{
No = string.Empty;
Name = string.Empty;
Price = string.Empty;
Region = string.Empty;
Shop = string.Empty;
}
public Product(string no, string name, string price, string region ,string shop)
{
No = no;
Name = name;
Price = price;
Region = region;
Shop = shop;
}
}
public class DataHelper
{
public static BindingList<Product> dataList = new BindingList<Product>()
{
new Product("1", "Computer", "1,000,000", "Korea", "A"),
new Product("2", "Monitor", "300,000", "KOREA", "B"),
new Product("3", "Keyboard", "100,000", "-", "C"),
new Product("4", "Mouse", "10,000", "China", "D"),
new Product("5", "Cola", "1,200", "USA", "U")
};
}
}
반응형