添加MSHFlexGrid将Name改成flex1
添加text 将name 改成txtedit
Public rs1 As New ADODB.Recordset, rs2 As New ADODB.Recordset ''定义数据集对象
Dim i As Integer, j As Integer
Sub EditKeyCode(MSHFlexGrid As Control, Edt As Control, KeyCode As Integer, Shift As Integer)
''标准编辑控件处理。
Select Case KeyCode
Case 27 ''ESC:隐藏焦点并将其返回 MSFlexGrid
Edt.Visible = False
MSHFlexGrid.SetFocus
Case 13 ''ENTER 将焦点返回 MSFlexGrid。
MSHFlexGrid.SetFocus
DoEvents
If MSHFlexGrid.Col < MSHFlexGrid.Cols - 1 Then
MSHFlexGrid.Col = MSHFlexGrid.Col + 1
Else
If MSHFlexGrid.Col = MSHFlexGrid.Cols - 1 Then
MSHFlexGrid.Row = MSHFlexGrid.Row + 1
MSHFlexGrid.Col = 1
End If
End If
Case 38 ''向上
MSHFlexGrid.SetFocus
DoEvents
If MSFlexGrid.Row > MSFlexGrid.FixedRows Then
MSFlexGrid.Row = MSFlexGrid.Row - 1
End If
End Select
End Sub
Sub view_DP()
If flex1.Col = 4 Or flex1.Col = 5 Or flex1.Col = 6 Then
''格式化Flex1表的第7列、第8列、第9列、第11列
flex1.TextMatrix(flex1.Row, 5) = Format(flex1.TextMatrix(flex1.Row, 5), "0.00")
flex1.TextMatrix(flex1.Row, 6) = Val(flex1.TextMatrix(flex1.Row, 4)) * Val(flex1.TextMatrix(flex1.Row, 5))
flex1.TextMatrix(flex1.Row, 6) = Format(flex1.TextMatrix(flex1.Row, 6), "0.00")
End If
Dim A, B As Single ''声明单精度浮点型变量
On Error Resume Next
For i = 1 To flex1.Rows - 1
If flex1.TextMatrix(i, 1) <>