当前位置:网站首页>C# Winform 关于ListView显示不全问题
C# Winform 关于ListView显示不全问题
2022-04-21 06:24:00 【祖安大龙】
在做窗体的时候,listview里 的数据总是显示不全,客户需要吗,就一定要用listview,然后我就试了一下,但是一直出现这个显示不全的问题,如下;

只显示了第列的值排列还不是符合预期,然后找了半天,代码也没什么毛病
listView1.Columns.Add("studentId");
listView1.Columns.Add("firstName");
listView1.Columns.Add("lastName");
listView1.Columns.Add("email");
listView1.Columns.Add("phoneNo");
listView1.Columns.Add("cga");
listView1.Columns.Add("departmentId");
listView1.Columns.Add("admissionYear");
//将集合中的数据放入listview1中
foreach (Class2 data in list)
{
//MessageBox.Show(data.First);
ListViewItem it = new ListViewItem();//构建一个listviewitem对象,通过它把数据放入listview1中
it.SubItems.Clear();
it.Text = data.Id;
//it.SubItems.Add(data.Id);
it.SubItems.Add(data.First);
it.SubItems.Add(data.Second);
it.SubItems.Add(data.Email);
it.SubItems.Add(data.Phone);
it.SubItems.Add(data.Cga.ToString());
it.SubItems.Add(data.Did);
it.SubItems.Add(data.Year.ToString());
listView1.Items.Add(it);//将数据放入listview1的items集合中,
}
最后发现,只要改一下listview的View属性值未Detail就可以了
得到的就是我们想要的结果了

再改改就行。。。鹅鹅鹅
版权声明
本文为[祖安大龙]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_44546342/article/details/121714320
边栏推荐
- D. 388535
- Simultaneous access of computer intranet and extranet - solution
- 彩虹(状压dp)
- 云计算中存储继承知识
- Guaba and Computational Geometry
- Solve the problem that the replacement traverses the circular call, resulting in the subsequent replacement replacing the data of the previous replacement
- C语言版:链队的建立和基本操作
- Remember a MySQL slow SQL optimization
- 【LeetCode 202】快乐数
- 登录页面讲解
猜你喜欢

This site cannot provide a secure connection. An unsupported protocol is used

SQL--数据的过滤和分组

推荐系统笔记(杂)
![[STM32] cubemx configuration diagram of 480mhz clock under 25MHz external crystal oscillator of h743](/img/7c/f7bc594f530ba44d59e365279021f3.png)
[STM32] cubemx configuration diagram of 480mhz clock under 25MHz external crystal oscillator of h743

dpdk 问题分析:ice 100G 网卡 rx_packets 与 rx_bytes 统计问题

C语言版:二叉树的静态建立

力扣-354.俄罗斯套娃信封问题

数据的导出

Reflection cannot find the class message classnotfound of UDF when executing flinksql code

Sql 按照指定内容排序
随机推荐
力扣-322.零钱兑换
Implémenter un tableau en tant que fonction JS. Prototype. Foreach (),. Map (),. Filtre ()
CF1427C The Hard Work of Paparazzi题解
The jupyter notebook of win10 uses pyspark 2 3.2 error reporting problems solved
The difference between on and where followed by conditions in the left join association table
GDB调试器安装与使用
如何实现一个线程池隔离?
将在CSDN中写好的文章导出为pdf格式
「Tarjan」有向图强连通分量
Analysis of distributed lock principle code using redis
【LeetCode 67】二个进制数求和
记录tx2上安装配置gestermer进而使用gst-rtsp-server
MySql分组 按某个字段排序取值第一条
2021年YCU蓝桥杯程序设计竞赛选拔赛题解
【LeetCode 290】单词规律
img= img.copy()报错
Sum of Numerators 思维
学习笔记-最长子序列,最大子方块
力扣-354.俄罗斯套娃信封问题
[SSM integration] 1 Basic environment construction