请看下段程序有什么问题,msflexgrid没有内容显示。也没有报错。谢谢!
Option Explicit
Public Sub ShowTitle()
With msgComputer
.Cols = 11
.TextMatrix(0, 1) = "Building"
.TextMatrix(0, 2) = "Department"
.TextMatrix(0, 3) = "Current User"
.TextMatrix(0, 4) = "Machine Name"
.TextMatrix(0, 5) = "Model"
.TextMatrix(0, 6) = "Serial Number"
.TextMatrix(0, 7) = "Monitor SN"
.TextMatrix(0, 8) = "Configuration"
.TextMatrix(0, 9) = "Lan MAC"
.TextMatrix(0, 10) = "Wireless MAC"
.ColWidth(0) = 500
.ColWidth(1) = 500
.ColWidth(2) = 500
.ColWidth(3) = 1000
.ColWidth(4) = 500
.ColWidth(5) = 1000
.ColWidth(6) = 1500
.ColWidth(7) = 1500
.ColWidth(8) = 2000
.ColWidth(9) = 2000
.ColWidth(10) = 2000
.FixedRows = 1
End With
End Sub
Public Sub ShowData()
Dim i As Integer
Dim strsqlcomputer As String
Dim objrstcomputer As New Recordset
strsqlcomputer = "Select * from computer"
objrstcomputer.Open strsqlcomputer, cnn, adOpenDynamic, adLockPessimistic
msgComputer.Rows = objrstcomputer.RecordCount + 1
objrstcomputer.MoveFirst
For i = 1 To objrstcomputer.RecordCount
msgComputer.TextMatrix(i, 1) = objrstcomputer.Fields(0)
msgComputer.TextMatrix(i, 2) = objrstcomputer.Fields(1)
msgComputer.TextMatrix(i, 3) = objrstcomputer.Fields(2)
msgComputer.TextMatrix(i, 4) = objrstcomputer.Fields(3)
msgComputer.TextMatrix(i, 5) = objrstcomputer.Fields(4)
msgComputer.TextMatrix(i, 6) = objrstcomputer.Fields(5)
msgComputer.TextMatrix(i, 7) = objrstcomputer.Fields(6)
msgComputer.TextMatrix(i, 8) = objrstcomputer.Fields(7)
msgComputer.TextMatrix(i, 9) = objrstcomputer.Fields(8)
msgComputer.TextMatrix(i, 10) = objrstcomputer.Fields(9)
If objrstcomputer.EOF Then
Exit For
End If
Next i
End Sub
Private Sub Form_Load()
ShowTitle
ShowData
End Sub
[此贴子已经被作者于2007-9-12 17:11:31编辑过]