现在有两个 vsflexgrid1 和 vsflexgrid2
通过什么样的方法将 vsflexgrid1表格的内容复制到 vsflexgrid2 ???
通过什么样的方法将 vsflexgrid1表格的内容复制到 vsflexgrid2 ???
解决方案 »
- 紧急求助:在线等待
- 我想向VFP的数据库表格的通用字段中写一个文件,但我无法用SQL语句实现,请指教!!!
- vb6。0运行工程,有时会自动整个工程都会退出,很不稳定。是何原因呢?(vb6.0补丁已安装)各位有没有遇到过这种情况?
- 我想通过我的程序去禁用一个硬件设备,比如声卡?网卡?有没有什么办法呢?
- 我是个初学者。有个这样的问题:如何取得日期差额?
- vb网络打印
- 问几个基本问题,不要笑话我啊!
- 定义数据类型出问题了,会的帮忙回答
- [关注]KeyHook问题,成功拦截,但出现问题!
- win7-32位 IE浏览器js调用批处理文件,命令窗口卡死
- activereport的报表在98为什么不能显示
- Timer控件的新认识!!!
用一个二维数组做中间变量
vsflexgrid2.BindToArray vsflexgrid1
或是先复制第一列,第二列,第三列.......
很简单的,你可以试试另外,楼上写的vsflexgrid2.bindtoarray vsflexgrid1中的bindtoarray属性是什么啊,我没用过,我也是刚刚才用vsflexgrid控件的,我找了一个简单的中文说明,说明中没写到bindtoarray这个方法,你能告诉我这个 方法是做什么用的嘛?谢谢
Dim arr(4, 8) ' Default binding:
fg.BindToArray arr
' fg now has 5 non-fixed columns (0-4) and 9 non-fixed rows (0-8).
' the mapping is: arr(i, j) = fg.TextArray(j - fg.FixedRows, i - fg.FixedCols) ' Transposed binding:
fg.BindToArray arr, 0, 1
' fg now has 9 non-fixed columns (0-8) and 5 non-fixed rows (0-4).
' the mapping is: arr(i, j) = fg.TextArray(i - fg.FixedRows, j - fg.FixedCols) ' ** Three-dimensional binding (AKA cube, notebook):
ReDim arr(4, 8, 12)
' Default binding:
fg.BindToArray arr
' by default, the last dimension becomes the "pages", and the
' current page is the first (0), so
' fa now has 5 non-fixed columns (0-4) and 9 non-fixed rows (0-8).
' the mapping is: arr(i, j, 0) = fg.TextArray(j - fg.FixedRows, i - fg.FixedCols) ' Page Flipping: fg.BindToArray arr, , , , 2 ' the row, col, and page settings are the default, and the current ' page is 2 (instead of the default 0), so ' fg now has 5 non-fixed columns (0-4) and 9 non-fixed rows (0-8).
' the mapping is: arr(i, j, 2) = fg.TextArray(j - fg.FixedRows, i - fg.FixedCols)
The BindToArray method also allows you to bind the control to another VSFlexGrid control. This way, you may create different "views" of the same data without having to keep duplicate copies of the data. The syntax is the same: fg.BindToArray fgSourceIn this case, the fg control will display the data stored in the fgSource control. Changes to cells in either control will reflect on the other. When binding to another VSFlexGrid control, the fixed cells are bound as well as the scrollable ones. The binding only applies to the data, not to the cell formats.To load data from an array or another VSFlexGrid control without binding, use the LoadArray method instead.
dim y as integer
y=0
for i=0 to 最大行
vsflexgrid2.textmatrix(i,y)=vsflexgrid1.textmatrix(i,y)
next这是只复制一行的方法,里面再套一个循环即可全复制了.
vsflexgrid2.BindToArray vsflexgrid1>>可行。
还有保存为交换文件也可实现!(本人作过)
dim y as integer
y=0
for i=0 to 最大行
vsflexgrid2.textmatrix(i,y)=vsflexgrid1.textmatrix(i,y)
next这是只复制一行的方法,里面再套一个循环即可全复制了.最无效率的办法!
整个COPY,后贴上就行了,不知道速度如何,应该比循环好点吧
vsflexgrid2.BindToArray vsflexgrid1>>可行。
还有保存为交换文件也可实现!(本人作过)
严重同意这两种作法.....我记得前些天回答了一个MSHFlexgrid复制数据的方法,但是在两个不同的窗体间.我记得直接用对象实现了.不过这个我在一个窗体中试了半天没弄出来.