以表格的形式输出 ,指定字段内容?解决思路

以表格的形式输出 ,指定字段内容????
例如有两个字段id 和 name

把字段id以表格的形式展示出来
格式例子

1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20 
21 22 23 24 25 26 27 28 29 30
31 .......

当鼠标单击数字时 text1里面就会显示id所对应的name字段内容

怎么做???(字段id是横向排序的哦)

------解决方案--------------------
'使用MSHFlexGrid控件
'设置列数(固定,假设为mc,不含固定列)

Dim RS As ADODB.Recordset

Private Sub Command1_Click()
Dim r As Long, c As Long

With RS
If .RecordCount > 0 Then
.MoveFirst
c = 1
r = 1
While Not .EOF
If c > MC Then
r = r + 1
c = 1
MSHFlexGrid1.AddItem '添加一行
End If
MSHFlexGrid1.TextMatrix(r, c) = CStr(RS("ID字段名称"))

c = c + 1
.MoveNext
Wend
End If
End With
End Sub
------解决方案--------------------
VB code

Private Sub Form_Load()
With MSHFlexGrid1
   .Width = 3350
   .FixedCols = 0
   .FixedRows = 0
   .Cols = 10
   .Rows = 150
   
   .ColWidth(-1) = 300
   
End With
With Adodc1
   .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db1.mdb;Persist Security Info=False"
   .RecordSource = "select * from tb1"
   .Refresh
    MSHFlexGrid1.Rows = Int(.Recordset.RecordCount / 10 + 0.9)
   
   Dim r As Long, c As Integer
   While Not .Recordset.EOF
      MSHFlexGrid1.TextMatrix(r, c) = .Recordset.Fields(0)
      c = c + 1
      If c > 9 Then c = 0: r = r + 1
      .Recordset.MoveNext
   Wend

 
End With


End Sub

Private Sub MSHFlexGrid1_Click()
    Text1 = ""
    Adodc1.Recordset.Find "ID=" & Val(MSHFlexGrid1.Text) & "", , , 1
    If Not Adodc1.Recordset.EOF Then Text1 = Adodc1.Recordset.Fields(1)
    
End Sub