询问者
dataGridView数据显示的怪问题

问题
-
string qSql = "select * from test";
DataTable dt = new DataTable();
dt = da.GetDataTableFromDatabase(connString, qSql); //从数据库查询出一个记录集,放到DataTable
dataGridView1.DataSource = dt;dt包含从左至右5个列 A,B,C,D,E
A B C D E 空列
但是显示到dataGridView1时,是从右边开始显示,从右至左5个列
空列 E D C B A
问题-->为什么dataGridView1会从右边开始显示?怎么解决这个问题?
全部回复
-
Hi,
欢迎在MSDN论坛发帖。
你可以上传一个demo 到one drive上面吗? 这样方便我们测试你的问题,然后找到解决方案。
你有尝试把得到的值都给显示出来吗?按照先后的顺序,这样就知道是什么原因导致数据显示出问题了,
根据我的搜索,datagridview 再使用bindingsource 的组件的时候,这个binding source 会管理跟数据交互的相信信息。
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
-
Demo的连接及密码
链接:https://pan.baidu.com/s/1micN0Nm 密码:pv8b
登录系统后(用户 1,密码1)
splitContainer1.Panel1中TreeView1显示菜单,点击TreeView1菜单中的 TestSystem 后,在splitContainer1.Panel2中显示formTestView
dataGridView在formTestView中。点击ShowData按钮,将数据显示到dataGridView中。
在这个Demo中数据从右开始显示。
数据库为PostgreSQL 10
- 已编辑 Luo.guohong 2017年12月28日 13:40
-
Hi,
欢迎你的反馈。
但是百度云盘,我们这边不允许安装,你这个需要下载百度云盘客户端。
你可以上传到one drive上面吗?
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.