Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Deleting datagrid rows depending on cloumn data

Posted on 2004-09-09
6
Medium Priority
?
225 Views
Last Modified: 2010-04-23
Hi,

I want to know how to delete certain rows from the datagrid depending on the column data. Like I have a column named Status. Under status I have data as "Available", "Unavailable". When I display the data, I want to select only "Available" and delete the rows which has "Unavailable" data at Status column. I am displaying the data from an XML file. Please let me know how I can get this done.

Reddy
0
Comment
Question by:angireddy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 4

Expert Comment

by:Javert93
ID: 12021661
How are you loading the XML file into the datagrid (Manually or through Data Binding)?
0
 

Author Comment

by:angireddy
ID: 12021711
Dim dsData As New DataSet()
filepath = "QCWorkQueue.xml"
dsData.ReadXml(filepath)
With dgData
      .DataSource = dsData
      .DataMember = "ProsWorkItem"
      .AllowSorting = True
End With
0
 
LVL 4

Accepted Solution

by:
Javert93 earned 2000 total points
ID: 12021809
Oh, you are storing the data in a DataSet that is persisted to disk. In that case, you can use a DataView to "filter" the DataSet and only expose the records that meet a certain criteria, like this:

        Dim dsData As New DataSet()
        dsData.ReadXml("QCWorkQueue.xml")

        Dim dvData As New DataView(dsData.Tables("ProsWorkItem"))
        dvData.RowFilter = "column_name = 'Available'"

        With dgData
            .DataSource = dvData
            .DataMember = "ProsWorkItem"
            .AllowSorting = True
        End With

Please note that I am assuming that the name of your table is "ProsWorkItem." Also, be sure to replace "column_name" with the name of your status column.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question