vb MSFlexGrid控件编写表格初始化

我要编写10行10列的数据显示表格选用MSFlexGrid控件表格初始化PublicSubtabint()Grid.Cols=10Grid.Rows=8+1Grid.Co... 我要编写10行10列的数据显示表格 选用MSFlexGrid控件
表格初始化
Public Sub tabint()
Grid.Cols = 10
Grid.Rows = 8 + 1
Grid.ColWidth = 950
For i = 0 To 8
Grid.Row = n: Grid.Text = ""
Next
Grid.Row = 0
Grid.Col = 0: Grid.Text = "序号"
Grid.Col = 1: Grid.Text = "电机转速"
Grid.Col = 2: Grid.Text = "风速1"
Grid.Col = 3: Grid.Text = "风速2"
Grid.Col = 4: Grid.Text = "风速3"
Grid.Col = 5: Grid.Text = "平均风速"
Grid.Col = 6: Grid.Text = "压力差1"
Grid.Col = 7: Grid.Text = "压力差2"
Grid.Col = 8: Grid.Text = "压力差3"
Grid.Col = 9: Grid.Text = "平均压力差"
Grid.TopRow = 1
Grid.LeftCol = 1
End Sub

为什么调试不出啊
Grid.Cols = 10
Grid.Rows = 8 + 1
For i = 1 To 8
Grid.ColWidth(i) = 1200
Next
For j = 1 To 8
For i = 1 To 8
Grid.Row = j: Grid.TextMatrix(j, i) = " "
Next
Next
Grid.Row = 0
Grid.Col = 0: Grid.Text = "序号"
Grid.Col = 1: Grid.Text = "电机转速"
Grid.Col = 2: Grid.Text = "风速1"
Grid.Col = 3: Grid.Text = "风速2"
Grid.Col = 4: Grid.Text = "风速3"
Grid.Col = 5: Grid.Text = "平均风速"
Grid.Col = 6: Grid.Text = "压力差1"
Grid.Col = 7: Grid.Text = "压力差2"
Grid.Col = 8: Grid.Text = "压力差3"
Grid.Col = 9: Grid.Text = "平均压力差"
Grid.TopRow = 1
Grid.LeftCol = 1
这样对了吗
展开
 我来答
恬然且爽快的小君子兰y
2008-05-07 · 超过12用户采纳过TA的回答
知道答主
回答量:90
采纳率:0%
帮助的人:0
展开全部
有两个关键地方,看一下代码
Public Sub tabint()
Grid.Cols = 10
Grid.Rows = 8 + 1

For i = 0 To 8
Grid.Row = n: Grid.Text = ""
Grid.ColWidth(i) = 1200 '(定制宽度是这样定的)
Next i '(for循环,你少了一个i)

Grid.Row = 0
Grid.Col = 0: Grid.Text = "序号"
Grid.Col = 1: Grid.Text = "电机转速"
Grid.Col = 2: Grid.Text = "风速1"
Grid.Col = 3: Grid.Text = "风速2"
Grid.Col = 4: Grid.Text = "风速3"
Grid.Col = 5: Grid.Text = "平均风速"
Grid.Col = 6: Grid.Text = "压力差1"
Grid.Col = 7: Grid.Text = "压力差2"
Grid.Col = 8: Grid.Text = "压力差3"
Grid.Col = 9: Grid.Text = "平均压力差"
Grid.TopRow = 1
Grid.LeftCol = 1
End Sub

你那样也行,调试一下可以就行了。不过我看你的代码,也学到了一些。原来next后面不接i或j也行啊。高!
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式