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
这样对了吗 展开
表格初始化
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
这样对了吗 展开
1个回答
展开全部
有两个关键地方,看一下代码
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也行啊。高!
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也行啊。高!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询