0

Hi,
I want to create a Alternate Coloring in MsFlexGrid that using the Visual Basic Programming.
Here I attach a source code :
MsFlexGrid I give name : Flex

If Wt <= RsParts.Fields!Lowerlimit Then

                '***********************************************************
                '2. Section for create Color at 1 Column under REMARK

                Dim lngRow As Long
                Dim lngBack As Long
                Dim lngMax As Long
                Dim lngMin As Long

                    For lngRow = 1 To .Rows - 1
                    'default background color

                    LowerUpper = "This Part Weight is Less Than LowerLimit"

                    'check for important values
                    If Val(.TextMatrix(lngRow, 1)) >= lngMax Then

                            'important color
                            lngBack = vbRed             'Backolor
                            lngMin = vbYellow           'Font Color

                        End If

                        'select whole row
                          .Row = lngRow
                          .Col = 4                  'Column for REMARK
                          .RowSel = lngRow
                          .ColSel = .Cols - 2       'Setfocus at COLUMN NO. 4

                          'set the background color of the selected row
                          .CellBackColor = lngBack
                          .CellForeColor = lngMin
                          .CellFontBold = True

                        Next lngRow
                         ElseIf Wt >= RsParts.Fields!upperlimit Then
         ![Terminal_System.jpg](/attachments/large/4/642565f3dfd0c4f2a428cf3118847715.jpg "align-center")                                     LowerUpper = "This Part Weight is Greater Than UpperLimit"
           ' MsgBox LowerUpper

        End If
                   End With
Exit Sub

err_Handler:

    Select Case Err.Number
        Case 3021  ' no record
            If sk = 0 Then
                MsgBox "Part Number database is empty !", vbOKOnly + vbInformation
            End If
                        Case Else

                    MsgBox Err.Number & "  " & Err.Description, vbExclamation + vbOKOnly
    End Select

In this code, just colour at 1 Column only ; REMARK Section (Can refer at attachment).
I want to create alternate colour at next Row when calibrate by Weighing Machine (vbGreen and vbYellow) without changing colour under REMARK Section.

If I'm using the code at below :

'Dim Lajur As Long       'Row
        'Dim Baris As Long       'Col

         '   .Redraw = True
         '   For Lajur = 1 To .Rows - 1 Step 2
         '   For Baris = .FixedCols To .Cols - 1
         '   .Row = Lajur
         '   .Col = Baris
         '   .CellBackColor = vbYellow

         '           Next

         '               Next

         '               .Redraw = False

It to be as attachment No. 2 (Terminal Weighing 2.jpg).

Can anyone give some idea ?

Attachments Terminal_System.jpg 68.81 KB Terminal_System.jpg 68.81 KB
2
Contributors
1
Reply
7
Views
4 Months
Discussion Span
Last Post by rproffitt
0

I've looked at attachments 1 and 2 and found no difference. Help me out here.

Edited by rproffitt

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.