MSFlexGrid

Sinsitrus Messages postés 849 Date d'inscription samedi 11 juin 2005 Statut Membre Dernière intervention 21 août 2015 - Modifié par Sinsitrus le 3/08/2014 à 18:07
leraymond Messages postés 2 Date d'inscription samedi 12 juillet 2014 Statut Membre Dernière intervention 14 septembre 2014 - 14 sept. 2014 à 12:00
Bonjour à tous !

J'utilise ce code pour afficher ma table :
Dim J As Integer

Set BAZ = New clsADO
BAZ.DBConnect App.Path & "\al_jabr_group.ajgb"
BAZ.RSExecute "SELECT * FROM tb_Rapport_General;"
    
Data.DatabaseName = App.Path & "\Al_Jabr_Group.ajgb"
Data.RecordSource = "tb_Rapport_General"
Data.Refresh

J = 0
If Not (Data.Recordset.BOF And Data.Recordset.EOF) Then
Data.Recordset.MoveLast
Data.Recordset.MoveFirst
MSFGrid.Rows = Data.Recordset.RecordCount + 1
J = 1
Do While Not Data.Recordset.EOF
MSFGrid.TextMatrix(J, 0) = Format(Data.Recordset!Matricule, "000000")
MSFGrid.TextMatrix(J, 1) = Data.Recordset!Employe
MSFGrid.TextMatrix(J, 2) = Format(Data.Recordset!SalaireBrut, "Standard")
MSFGrid.TextMatrix(J, 3) = Format(Data.Recordset!Avantage, "Standard")
MSFGrid.TextMatrix(J, 4) = Format(Data.Recordset!Transport, "Standard")
MSFGrid.TextMatrix(J, 5) = Format(Data.Recordset!Telephone, "Standard")
MSFGrid.TextMatrix(J, 6) = Format(Data.Recordset!Accompte, "Standard")
MSFGrid.TextMatrix(J, 7) = Format(Data.Recordset!SalaireNet, "Standard")
MSFGrid.TextMatrix(J, 8) = Format(Data.Recordset!Pret, "Standard")
J = J + 1
Data.Recordset.MoveNext
Loop
End If


Je souhaiterais que là où la valeur de
MSFGrid.TextMatrix(J, 8) est > 0
, la ligne entière se colorie en rouge.

Pouvez-vous m'aider svp ?

Merci

----------
OS : Windows 7 Pro 64 Bit
Platforme : Visual Basic 6.0

3 réponses

Whismeril Messages postés 19025 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 19 avril 2024 656
3 août 2014 à 18:27
Message déplacé vers la catégorie VB6
0
Sinsitrus Messages postés 849 Date d'inscription samedi 11 juin 2005 Statut Membre Dernière intervention 21 août 2015
Modifié par Sinsitrus le 3/08/2014 à 19:23
Après avoir changé mon code, je me retrouve avec la dernière ligne colorée... je n'arrives pas à faire le tour du tableau :

Dim J As Integer
Dim Ligne As Integer
Dim Colonne As Integer
 
Set BAZ = New clsADO
BAZ.DBConnect App.Path & "\al_jabr_group.ajgb"
BAZ.RSExecute "SELECT * FROM tb_Rapport_General;"
 
Data.DatabaseName = App.Path & "\Al_Jabr_Group.ajgb"
Data.RecordSource = "tb_Rapport_General"
Data.Refresh
'---------------------------------------------------------
J = 0
 
If Not (Data.Recordset.BOF And Data.Recordset.EOF) Then
Data.Recordset.MoveLast
Data.Recordset.MoveFirst
MSFGrid.Rows = Data.Recordset.RecordCount + 1
J = 1
Do While Not Data.Recordset.EOF
MSFGrid.TextMatrix(J, 0) = Format(Data.Recordset!Matricule, "000000")
MSFGrid.TextMatrix(J, 1) = Data.Recordset!Employe
MSFGrid.TextMatrix(J, 2) = Format(Data.Recordset!SalaireBrut, "Standard")
MSFGrid.TextMatrix(J, 3) = Format(Data.Recordset!Avantage, "Standard")
MSFGrid.TextMatrix(J, 4) = Format(Data.Recordset!Transport, "Standard")
MSFGrid.TextMatrix(J, 5) = Format(Data.Recordset!Telephone, "Standard")
MSFGrid.TextMatrix(J, 6) = Format(Data.Recordset!Accompte, "Standard")
MSFGrid.TextMatrix(J, 7) = Format(Data.Recordset!SalaireNet, "Standard")
MSFGrid.TextMatrix(J, 8) = Format(Data.Recordset!Pret, "Standard")
 
'-----------------------------------------------
For Ligne = 1 To MSFGrid.Rows - 1
MSFGrid.Row = Ligne

If Ligne Mod 2 = 0 Then
    For Colonne = 0 To MSFGrid.Cols - 1
    MSFGrid.Col = Colonne
    MSFGrid.CellBackColor = RGB(226, 243, 245)
    Next Colonne
End If
Next Ligne

MSFGrid.Row = J
If MSFGrid.TextMatrix(J, 8) > 0 Then
    For Colonne = 0 To MSFGrid.Cols - 1
    MSFGrid.Col = Colonne
    MSFGrid.CellBackColor = RGB(244, 207, 206)
    Next Colonne
End If
'-----------------------------------------------
J = J + 1
Data.Recordset.MoveNext
Loop
End If


Je galère grave !
0
leraymond Messages postés 2 Date d'inscription samedi 12 juillet 2014 Statut Membre Dernière intervention 14 septembre 2014
Modifié par leraymond le 14/09/2014 à 12:01
on peut essayer ça..
if val(msflexgrid.textmatrix(j,8)) > 0 then
msflexgrid.row=j
msflexgrid.col=8
msflexgrid.cellforecolor = qbcolor(12)
end if
0
Rejoignez-nous