| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2304 人关注过本帖
标题:msflexgrid 不能显示。
取消只看楼主 加入收藏
vbtom
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2007-9-5
收藏
 问题点数:0 回复次数:3 
msflexgrid 不能显示。

请看下段程序有什么问题,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编辑过]

搜索更多相关主题的帖子: quot msflexgrid TextMatrix Department Monitor 
2007-09-12 17:05
vbtom
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2007-9-5
收藏
得分:0 
谢谢!加了这一句,还是没有显示!
2007-09-12 17:23
vbtom
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2007-9-5
收藏
得分:0 
让两位大侠见笑了。问题还没解决。用西风老大的方法,总是提示" Run-time error 94, Invalid use of Null"
参考了网上的一些方法,程序整理如下,可仍然有Invalid use of Null错误(指向循环体内)。为什么呀?很烦。不想用datagrid.

Public Sub ShowData()
Dim iRow As String
Dim strsqlcomputer As String
Dim objrstcomputer As New ADODB.Recordset
strsqlcomputer = "select * from computer"
If objrstcomputer.State = 1 Then objrstcomputer.Close
objrstcomputer.Open strsqlcomputer, cnn, adOpenKeyset, adLockPessimistic
msgComputer.Cols = 11
With msgComputer
.Redraw = False
.Rows = 2
iRow = 0
objrstcomputer.MoveFirst
Do While Not objrstcomputer.EOF
iRow = iRow + 1
If iRow >= .Rows Then .Rows = .Rows + 1
.TextMatrix(iRow, 1) = Trim(objrstcomputer.Fields(0))
.TextMatrix(iRow, 2) = Trim(objrstcomputer.Fields(1))
.TextMatrix(iRow, 3) = Trim(objrstcomputer.Fields(2))
.TextMatrix(iRow, 4) = Trim(objrstcomputer.Fields(3))
.TextMatrix(iRow, 5) = Trim(objrstcomputer.Fields(4))
.TextMatrix(iRow, 6) = Trim(objrstcomputer.Fields(5))
.TextMatrix(iRow, 7) = Trim(objrstcomputer.Fields(6))
.TextMatrix(iRow, 8) = Trim(objrstcomputer.Fields(7))
.TextMatrix(iRow, 9) = Trim(objrstcomputer.Fields(8))
.TextMatrix(iRow, 10) = Trim(objrstcomputer.Fields(9))
objrstcomputer.MoveNext
Loop
End With

End Sub
2007-09-14 15:27
vbtom
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2007-9-5
收藏
得分:0 
谢谢,西风老大,刚才做了一下测试,OK。thank you again!
2007-09-14 16:07
快速回复:msflexgrid 不能显示。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033193 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved