[英]Display Data in a table win form C#
I need to present data in a tabular form in windows form using c#. 我需要使用c#在Windows窗体中以表格形式显示数据。 Basically, I will extract data from received messages (not database) then display it in a table by specifying the column and row. 基本上,我将从接收到的消息(不是数据库)中提取数据,然后通过指定列和行将其显示在表中。
First, I started with TableLayoutPanel
but I discovered that I should add controls for each cell which is not what I need and it is tedious. 首先,我从TableLayoutPanel
开始,但是我发现我应该为每个单元格添加控件,这不是我所需要的,而且很繁琐。
Do you have any better suggestion? 您有更好的建议吗? Much appreciated. 非常感激。
I think you're best off using a DataGridView
, see this link . 我认为您最好使用DataGridView
,请参阅此链接 。
It allows you to assign a datasource (which you can specify yourself). 它允许您分配一个数据源(您可以指定自己)。 The image below demonstrates one of many ways that you can make your dataview look like. 下图演示了使数据视图看起来像的多种方法之一。
There is even a nice tutorial which you can follow right here . 甚至还有一个不错的教程,您都可以在这里进行学习 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.