参考 读数据 放在文本里 dgrecord 是vshflexgrid的名字 rsqdangan是记录集的名字 Dim CurRow As Integer Dim CurCol As Integer If RsQDangan.RecordCount > 0 Then CurRow = dgrecord.RowIf CurRow = dgrecord.Rows Then Exit Subtxtdanwei.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
dgrecord 是vshflexgrid的名字
rsqdangan是记录集的名字
Dim CurRow As Integer
Dim CurCol As Integer
If RsQDangan.RecordCount > 0 Then
CurRow = dgrecord.RowIf CurRow = dgrecord.Rows Then Exit Subtxtdanwei.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
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