Solved

Deleting datagrid rows depending on cloumn data

Posted on 2004-09-09
6
223 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 500 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

632 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