1PrivateSubcustomerDataGridView_CellFormatting(ByValsenderAsObject,ByValeAsDataGridViewCellFormattingEventArgs)HandlescustomerDataGridView.CellFormatting
2
3 ’Ifthecolumnbeingformattedisthecolumnnamed’Status’..
4 IfMe.customerDataGridView.Columns(e.ColumnIndex).Name="Status"Then
5 Ife.ValueIsNotNothingThen
6 ’Ifthevalueofthecellis"Inactive"ANDthisform’sinactiveCustomersCheckBoxcontrolischecked..
7 Ife.Value.ToString="Inactive"AndMe.inactiveCustomersCheckBox.CheckedThen
8 ’SettheBackColorofthecelltoyellow.
9 e.CellStyle.BackColor=Color.Yellow
10 EndIf
11 EndIf
12 EndIf
13
14 ’Ifthecolumnbeingformattedisthecolumnnamed’LastOrderDate’..
15 IfMe.customerDataGridView.Columns(e.ColumnIndex).Name="LastOrderDate"Then
16 Ife.ValueIsNotNothingThen
17 ’IfLastOrderDatewasmorethan30daysagoANDthisform’sordersOverdueCheckBoxcontrolischecked..
18 IfDate.Now.Subtract(CType(e.Value,Date)).Days>30AndMe.orderOverdueCheckBox.CheckedThen
19 ’SettheBackColorofthecelltoyellow-green.
20 e.CellStyle.BackColor=Color.YellowGreen
21 EndIf
22 EndIf
23 EndIf
24EndSub
责任编辑:小草