Click here to Skip to main content
15,667,626 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi guys so i got a datagridview that has a dataset that is linked to a xml file,I got to display the data in the datagridview but what i want to do now is take out rows that has certain values,this is my code
'Load Creditors data
               Dim CPADataset As New DataSet
               Dim NLRDataset As DataSet = New DataSet
               Dim CPANode As XmlNode = doc.SelectSingleNode("ROOT/EnqCC_CPA_ACCOUNTS")
               Dim NLRNode As XmlNode = doc.SelectSingleNode("ROOT/EnqCC_NLR_ACCOUNTS")
               Dim NLRXMLRdr As XmlNodeReader = New XmlNodeReader(NLRNode)
               Dim CPAXMLRdr As XmlNodeReader = New XmlNodeReader(CPANode)

               dgvCPA.DataSource = CPADataset
               dgvCPA.DataMember = "ROW"
               Dim chk1, chk2 As New DataGridViewCheckBoxColumn
               With dgvCPA
                   '   .RowHeadersVisible = False
                   .Columns("SUBSCRIBER_CODE").Visible = False
                   .Columns("SUBSCRIBER_NAME").Visible = True
                   .Columns("BRANCH_CODE").Visible = False
                   .Columns("ACCOUNT_NO").Visible = True
                   .Columns("SUB_ACCOUNT_NO").Visible = False
                   .Columns("OWNERSHIP_TYPE").Visible = False
                   .Columns("OWNERSHIP_TYPE_DESC").Visible = False
                   .Columns("REASON").Visible = False
                   .Columns("REASON_DESC").Visible = False
                   .Columns("PAYMENT_TYPE").Visible = False
                   .Columns("PAYMENT_TYPE_DESC").Visible = False
                   .Columns("ACCOUNT_TYPE").Visible = False
                   .Columns("ACCOUNT_TYPE_DESC").Visible = True
                   .Columns("OPEN_DATE").Visible = False
                   .Columns("DEFERRED_PAYMENT_DATE").Visible = False
                   .Columns("LAST_PAYMENT_DATE").Visible = True
                   .Columns("OPEN_BAL").Visible = False
                   .Columns("OPEN_BAL_IND").Visible = False
                   .Columns("CURRENT_BAL").Visible = True
                   .Columns("CURRENT_BAL_IND").Visible = False
                   .Columns("OVERDUE_AMOUNT").Visible = True
                   .Columns("OVERDUE_AMOUNT_IND").Visible = False
                   .Columns("INSTALMENT_AMOUNT").Visible = True
                   .Columns("ARREARS_PERIOD").Visible = True
                   .Columns("REPAYMENT_FREQ").Visible = False
                   .Columns("REPAYMENT_FREQ_DESC").Visible = True
                   .Columns("TERMS").Visible = False
                   .Columns("STATUS_CODE").Visible = False
                   .Columns("STATUS_CODE_DESC").Visible = True
                   .Columns("STATUS_DATE").Visible = False
                   .Columns("THIRD_PARTY_NAME").Visible = False
                   .Columns("THIRD_PARTY_SOLD").Visible = False
                   .Columns("THIRD_PARTY_SOLD_DESC").Visible = False
                   .Columns("JOINT_LOAN_PARTICIPANTS").Visible = False
                   .Columns("PAYMENT_HISTORY").Visible = False
                   .Columns("PAYMENT_HISTORY_STATUS").Visible = False
                   .Columns("MONTH_END_DATE").Visible = False
                   .Columns("DATE_CREATED").Visible = False
                   .Columns("num").Visible = False
               End With

by .
Columns("STATUS_CODE_DESC").Visible = True

theres records in that column that has a value called "Closed".my question is how do i take out that row that has "Closed in it"

What I have tried:

For Each rows As DataGridView In dgvCPA.Rows
If rows("STATUS_CODE_DESC").value.tostring() = "EARLY SETTLEMENT" Then
rows.[ReadOnly] = True
rows.DefaultCellStyle.BackColor = Color.Red
rows.[ReadOnly] = False
rows.DefaultCellStyle.BackColor = Color.White
End If
Catch ex As Exception
Throw ex
End Try

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900