1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
Function faIndex(Row As Integer, Col As Integer) As Long
On Error Resume Next
faIndex = Row * G.Cols + Col
End Function
Private Sub G_KeyPressEdit(ByVal Row As Long, ByVal Col As Long, KeyAscii As Integer)
On Error Resume Next
Dim C As Integer, R As Integer
' Désactive le clignotement du contrôle
G.Redraw = False
' Repère la cellule active
R = G.RowSel
C = G.ColSel
' Valide la saisie au clavier
If KeyAscii = 27 Then
G.TextArray(faIndex(R, C)) = ""
ElseIf G.TextArray(faIndex(R, C)) <> "" And KeyAscii = 8 Then
G.TextArray(faIndex(R, C)) = Mid(G.TextArray(faIndex(R, C)), 1, Len(G.TextArray(faIndex(R, C))) - 1)
ElseIf G.TextArray(faIndex(R, C)) <> "" And KeyAscii = 13 Then
G.TextArray(faIndex(R, C)) = G.TextArray(faIndex(R, C)) & Chr(10) & Chr(KeyAscii)
Else
G.TextArray(faIndex(R, C)) = G.TextArray(faIndex(R, C)) & Chr(KeyAscii)
End If
' Replace le clignotement du contrôle
G.Redraw = True
'appel mise ajour G
G_ChangeEdit
End Sub
Private Sub G_ChangeEdit()
On Error Resume Next
Dim Q1 As Double
Dim P2 As Double
Dim R3 As Double
Dim TOT1 As Double
Dim TOT2 As Double
Dim TOT3 As Double
Dim x As Integer
With G
R = .Row
Q1 = .TextMatrix(R, 2)
P2 = .TextMatrix(R, 3)
R3 = .TextMatrix(R, 4)
TOT1 = Q1 * P2
TOT2 = TOT1 * R3 / 100
TOT3 = TOT1 - TOT2
.TextMatrix(R, 5) = Format(CCur(TOT3), "standard")
End With
nbr.Caption = 0: totaux.Caption = 0
For I = 1 To G.Rows - 1
nbr.Caption = Val(nbr.Caption) + 1
htT = htT + CCur(G.TextMatrix(I, 5))
Next
totaux.Caption = Format(CCur(htT), "standard")
End Sub |
Partager