首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

怎么把MSFlexGrid中的某一列数据取出放到数组中

2012-02-12 
如何把MSFlexGrid中的某一列数据取出放到数组中!列入某一列有多个货物货物××//这些如何取出并存放在数组中

如何把MSFlexGrid中的某一列数据取出放到数组中!
列入某一列有多个货物
货物
××         //这些如何取出并存放在数组中
××
××

[解决办法]
参考 读数据 放在文本里
dgrecord 是vshflexgrid的名字
rsqdangan是记录集的名字
Dim CurRow As Integer
Dim CurCol As Integer
If RsQDangan.RecordCount > 0 Then
CurRow = dgrecord.Row

If CurRow = dgrecord.Rows Then Exit Sub

txtdanwei.Text = Trim(dgrecord.TextMatrix(CurRow, 0))

txtnum.Text = Trim(dgrecord.TextMatrix(CurRow, 1))
txtpinpai.Text = dgrecord.TextMatrix(CurRow, 2)
txtchangjia.Text = Trim(dgrecord.TextMatrix(CurRow, 3))
txtguige.Text = Trim(dgrecord.TextMatrix(CurRow, 4))
txtleibie.Text = Trim(dgrecord.TextMatrix(CurRow, 5))

End If


[解决办法]
不是都说了么便历,你是不是要代码阿

1.你首先要知道你要找的是那一列,暂且定j
for i=1 to grid.rows-1
grid.TextMatrix(i,j) 就是你要的了
next


[解决办法]
//取一行
dim Txt() as string
dim iLoop as integer
dim IntCol as integer
IntCol = grid.cols
redim Txt(IntCol-1) as string
for iLoop = 0 to IntCol -1
Txt(iLoop) = grid.TextMatrix(grid.row,iLoop)
next
//取一列
dim Txt() as string
dim iLoop as integer
dim IntRow as integer
IntRow = grid.Rows
redim Txt(IntRow-1) as string
for iLoop = 0 to IntRow -1
Txt(iLoop) = grid.TextMatrix(grid,iLoop)
next


热点排行