如何在填充datagridview固定行后创建第二列 [英] How to create second columns after fill our datagridview fixed rows

查看:65
本文介绍了如何在填充datagridview固定行后创建第二列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I am creating windows application using c# 2010 – here I am using data grid view, my data grid view default height 363, here I want : my data grid view rows 5 only enough, how to control the grid view.
And I am entered 5 rows completed automatically create second columns again 5 rows.

My Colums
Slno	 mts	 cms			Slno	 mts	 cms
1					1	
2					2
3					3
4					4
5					5

How to create above method any one give me ideas.





我尝试过:



如何在填充datagridview固定行后创建第二列



What I have tried:

How to create second columns after fill our datagridview fixed rows

推荐答案

这真是一个奇怪的要求吗?

我们首先想知道实际要求,以便我们能够建议您采用更好的方法。



但如果您不想考虑上述建议,可以获取数据表的帮助。将数据保存在数据表中并创建另一个空白数据表。现在运行一个5的循环来填充第二个数据表。你的逻辑应该是,首先添加所需的否。列和第一个循环完成后添加新列以填充下一个数据序列。第二个循环也开始从第一行填充数据,但是从新列填充并重复该过程,直到第一个数据表中的所有行都填入第二个数据表。



如果你在实现这个问题时遇到任何困难或问题,请告诉我。



希望,它有帮助:)
That's a weird requirement really?
We would like to know the actual requirement first so that we will be able to suggest you a better approach.

But if you don't want to consider the above suggestion, you can take help of datatable. Keep the data in the datatable and create another blank datatable. Now run a loop of 5 to fill the second datatable. Your logic should be, first add the required no. of columns and once the first loop gets completed add new columns for filling the next sequence of data. The second loop also starts filling data from 1st row but from the new column and repeat the process till all your rows from first datatable is filled in to the second datatable.

If you find any difficulties or issue while implementing this, please let me know.

Hope, it helps :)


这篇关于如何在填充datagridview固定行后创建第二列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆