MSHFlexGrid控件问题。小妹及用,请各位大哥哥帮帮忙。

370602800831432 2002-10-30 09:49:04
rec.Open ssql, conn, adOpenKeyset, adLockOptimistic, adCmdText
If Not rec.EOF Then
Set MSHFlexGrid1.DataSource = rec
Jd = DatePart("m", Now) - 1
TMonth = CStr(Jd) & "-26"
zc = DatePart("ww", TMonth)
For i = 1 To MSHFlexGrid1.Rows - 1

MSHFlexGrid1.TextMatrix(i, 0) = Val(MSHFlexGrid1.TextMatrix(i, 0)) - zc + 1

Select Case Me.MSHFlexGrid1.TextMatrix(i, 0)
Case 1
Me.Picture1.CurrentX = 5150 * 0.5
Me.Picture1.CurrentY = 6500 * 0.5
Me.Picture1.Print (Me.MSHFlexGrid1.TextMatrix(i, 1)) * 1 + (Me.MSHFlexGrid5.TextMatrix(i, 1)) * 1
yf1 = (Me.MSHFlexGrid1.TextMatrix(i, 1)) * 1 + (Me.MSHFlexGrid5.TextMatrix(i, 1)) * 1
Case 2
Me.Picture1.CurrentX = 5650 * 0.5
Me.Picture1.CurrentY = 6500 * 0.5
Me.Picture1.Print (Me.MSHFlexGrid1.TextMatrix(i, 1)) * 1 + (Me.MSHFlexGrid5.TextMatrix(i, 1)) * 1
yf2 = (Me.MSHFlexGrid1.TextMatrix(i, 1)) * 1 + (Me.MSHFlexGrid5.TextMatrix(i, 1)) * 1
Case 3
Me.Picture1.CurrentX = 6150 * 0.5
Me.Picture1.CurrentY = 6500 * 0.5
Me.Picture1.Print (Me.MSHFlexGrid1.TextMatrix(i, 1)) * 1 + (Me.MSHFlexGrid5.TextMatrix(i, 1)) * 1
yf3 = (Me.MSHFlexGrid1.TextMatrix(i, 1)) * 1 + (Me.MSHFlexGrid5.TextMatrix(i, 1)) * 1
Case 4
Me.Picture1.CurrentX = 6650 * 0.5
Me.Picture1.CurrentY = 6500 * 0.5
Me.Picture1.Print (Me.MSHFlexGrid1.TextMatrix(i, 1)) * 1 + (Me.MSHFlexGrid5.TextMatrix(i, 1)) * 1
yf4 = (Me.MSHFlexGrid1.TextMatrix(i, 1)) * 1 + (Me.MSHFlexGrid5.TextMatrix(i, 1)) * 1
Case 5
Me.Picture1.CurrentX = 7150 * 0.5
Me.Picture1.CurrentY = 6500 * 0.5
Me.Picture1.Print (Me.MSHFlexGrid1.TextMatrix(i, 1)) * 1 + (Me.MSHFlexGrid5.TextMatrix(i, 1)) * 1
yf5 = (Me.MSHFlexGrid1.TextMatrix(i, 1)) * 1 + (Me.MSHFlexGrid5.TextMatrix(i, 1)) * 1
End Select

Next

End If
rec.Close
这段代码在运行的时候只要。msh1和MSH5的行数不一样。或都MSH5为空。就会出错。我相请各位大哥哥帮帮忙怎样让msh1 和MSH5的行数都固定为6行。小妹急用。请各位大哥哥,一定帮帮小妹。
...全文
41 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
fling_boy 2002-10-30
  • 打赏
  • 举报
回复
msh1的行数是由返回的记录集决定的,msh5的行数你没有明确说明。
如果想让两个都是6行,你可以在for循环前加上
msh1.rows=6
msh5.rows=6
我不明白你的程序是做什么的,还有你写的代码也太不规范了,以后要把这个写好点。看着都头晕。

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧