当前位置:网站首页>C form application uses object binding DataGridView data binding
C form application uses object binding DataGridView data binding
2022-07-28 09:41:00 【InfoQ】
First step Create form file
The second step Create a successful form file display
The third step Handle the toolbox
Step four establish DatagridView Control
Step five Create a class library
Step six Create a class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WindowsFormsApp2
{
class Class1
{
private int id;
private string name;
private string age;
public Class1()
{
}
public int Id { get => id; set => id = value; }
public string Name { get => name; set => name = value; }
public string Age { get => age; set => age = value; }
}
}
Copy code
Step seven Classes that reference class libraries
Step eight Code and effect display
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;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Class1 c1 = new Class1();
c1.Id = 1;
c1.Name = "IC00";
c1.Age = "18";
List<Class1> list = new List<Class1>();
list.Add(c1);
dataGridView1.DataSource = list;
}
}
}
Copy code
summary :
边栏推荐
- Window source code analysis (II): the adding mechanism of window
- 【打包部署】
- 376. 摆动序列【贪心、动态规划------】
- [vscode] vscode usage
- JS array is de duplicated, the ID is the same, and a value is added and merged
- 数据泄漏、删除事件频发,企业应如何构建安全防线?
- JDBC连接数据库
- MATLAB的符号运算
- MySQL 8.0.30 GA
- LeetCode_ 406_ Rebuild the queue based on height
猜你喜欢

QT basic hand training applet - simple calculator design (with source code, analysis)

【一花一世界-郑一教授-繁简之道】可解释神经网络

opencv安装配置测试

Express builds a simple local background (1)

2022 high voltage electrician examination simulated 100 questions and simulated examination

Go language slice vs array panic runtime error index out of range problem solving

股指期货开户的条件和流程

QT基础练手小程序-简单计算器设计(附带源码,解析)

树上启发式合并
![【解决】ERROR in [eslint] ESLint is not a constructor](/img/58/2ce1243d0085462af3ba6d3da0817d.png)
【解决】ERROR in [eslint] ESLint is not a constructor
随机推荐
Final keyword and enumeration type
MATLAB的符号运算
业务可视化-让你的流程图'Run'起来(4.实际业务场景测试)
技术分享| 快对讲综合调度系统
7 C control statements: branches and jumps
MySQL中各类型文件详解
[JVM] JVM refers to floating point number
[autosar-rte] - introduction of 2-component, component and VFB
这两套代码有什么区别呢?
376. Swing sequence [greedy, dynamic planning -----]
【C语言】详解顺序表(SeqList)
SD卡介绍(基于SPEC3.0)
Dn-detr paper accuracy, and analyze its model structure & 2022 CVPR paper
c# 有符号和无符号字节变量
使用 OpenSSL 创建ssl证书
IJCAI 2022 | the latest overview of graph structure learning: research progress and future prospects
C# 窗体应用使用对象绑定 DataGridView 数据绑定
对话MySQL之父:代码一次性完成才是优秀程序员
JDBC连接数据库
[log] what does a log do? What is a log factory? Configuration and use of log4j? log4j. Properties file configuration, log4j jar package coordinates