|
-
Feb 14th, 2003, 10:14 PM
#1
Thread Starter
Member
Color cell with MSFLEXGrid! Pls help me!
Hi all,
With one value for 1 cell want to set one color. Mean: if me.MSFLEXGrid.textmatrix(col, row)='A' this cell has red color
elseif me.MSFLEXGrid.textmatrix(col, row)='B' this cell has Blue color. What should I do? Please help me to solve this problem.
Thanks in advance.
-
Feb 14th, 2003, 10:28 PM
#2
PowerPoster
WELL
VB Code:
' THIS EXAMPLE WILL LOOP THRU EACH ROW, BUT ONLY ONE COLUMN
Dim IntNext as Integer, IntMax as Integer
IntMax = Me.MsflexGrid1.Rows - Me.MsflexGrid1.FixedRows
For IntNext = 1 to IntMax
Me.MsFlexGrid1.Col = 1
Me.MsFlexGrid1.Row = IntNext
Select Case Me.MsFlexGrid1.TextMatrix(IntNext,1)
Case "A"
Me.MsFlexGrid1.Row = vbRed
Case "B"
Me.MsFlexGrid1.Row = vbBlue
End Select
' LOOP TO NEXT ROW
Next
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Feb 14th, 2003, 10:46 PM
#3
Thread Starter
Member
Thanks alot. I try it now!
-
Feb 14th, 2003, 10:48 PM
#4
PowerPoster
Well
Originally posted by chiavoi
Thanks alot. I try it now!
Hope it helps...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Feb 14th, 2003, 11:28 PM
#5
Thread Starter
Member
But I got this message:
"Invalid Row value". Is there another way? Or I made sone thing wrong. This is my code:
strS = ""
strS = "select * from RoomNo"
Call ados.Open(strS, cnn, adOpenKeyset, adLockOptimistic)
If Not ados.EOF And Not ados.BOF Then
i = 1
ados.MoveFirst
While Not ados.EOF
Me.msfR.Rows = i + 1
Me.msfR.Row = i
If Not IsNull(ados.Fields("RoomNo")) Then
Me.msfR.TextMatrix(i, 1) = ados.Fields("RoomNo")
Else
Me.msfR.TextMatrix(i, 1) = ""
End If
For j = 1 To Me.msfR.Cols - 1
If ados.Fields("Empty") Then
Me.msfR.Row = vbBlue
Else
Me.msfR.Row = vbWhite
End If
If ados.Fields("Reser") Then
Me.msfR.Row = vbGreen
Else
Me.msfR.Row = vbWhite
End If
If ados.Fields("Lodging") Then
Me.msfR.Row = vbRed
Else
Me.msfR.Row = vbWhite
End If
If ados.Fields("Repair") Then
Me.msfR.Row = vbYellow
Else
Me.msfR.Row = vbWhite
End If
Next j
i = i + 1
ados.MoveNext
Wend
Thanks in advance!
-
Feb 14th, 2003, 11:30 PM
#6
PowerPoster
Well
Oops try this :
VB Code:
' THIS EXAMPLE WILL LOOP THRU EACH ROW, BUT ONLY ONE COLUMN
Dim IntNext as Integer, IntMax as Integer
IntMax = Me.MsflexGrid1.Rows - Me.MsflexGrid1.FixedRows
For IntNext = 1 to IntMax
Me.MsFlexGrid1.Col = 1
Me.MsFlexGrid1.Row = IntNext
Select Case Me.MsFlexGrid1.TextMatrix(IntNext,1)
Case "A"
Me.MsFlexGrid1.CellBackCOlor = vbRed
Case "B"
Me.MsFlexGrid1.CellBackCOlor = vbBlue
End Select
' LOOP TO NEXT ROW
Next
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|