"" And flex1.TextMatrix(i, 4) <> "" And flex1.TextMatrix(i, 6) <> "" Then
A = Val(flex1.TextMatrix(i, 6)) + A ''求合计金额
B = Val(flex1.TextMatrix(i, 4)) + B ''求合计数量
End If
Next i
lblCount = B
lblSum = Format(A, "0.00") ''格式化合计金额
End Sub
Sub SetButtons(bVal As Boolean)
cmdRegister.Enabled = Not bVal
cmdSave.Enabled = bVal
cmdCancel.Enabled = bVal
flex1.Enabled = bVal
Frame1.Enabled = bVal
End Sub
Private Sub DataGrid2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode =
vbKeyReturn Then
With Adodc2.Recordset
''赋值给flex1表格
If .Fields("商品名称") <> "" Then flex1.TextMatrix(flex1.Row, 1) = Trim(.Fields("商品名称"))
If .Fields("规格") <> "" Then flex1.TextMatrix(flex1.Row, 2) = Trim(.Fields("规格"))
If .Fields("单位") <> "" Then flex1.TextMatrix(flex1.Row, 3) = Trim(.Fields("单位"))
flex1.TextMatrix(flex1.Row, 5) = .Fields("成本价")
End With
flex1.Col = 4
DataGrid2.Visible = False ''DataGrid2不可见
txtEdit.Text = ""
txtEdit.SetFocus
End If
If KeyCode = vbKeyEscape Then ''按ESC键DataGrid2不可见
DataGrid2.Visible = False
'' txtEdit.SetFocus ''txtEdit获得焦点
End If
End Sub
Private Sub delone_Click()
For i = 1 To flex1.Cols - 1
flex1.TextMatrix(flex1.Row, i) = ""
Next i
view_DP
End Sub
Private Sub flex1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
''利用PopupMenu方法
If Button And vbRightButton Then
PopupMenu edit