Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating DatagridView with XMl data using criteria

Status
Not open for further replies.

jpack23

Programmer
Dec 15, 2004
82
US
Hi, Thanks for you time. I want to populate a datagridview with records from an XML document. I can get all the records in the grid using the following code

Dim filePath as String = "c:\path\XML.XML"

Me.dsRecords.ReadXML(filePath)

dgvRecords.DataSource = dsRecords
dgvRecords.DataMember = "XML"

How do I get only records that match a certain criteria in the datagridview?

I also want to sort the grid?

Thank you for your help

joe
 

You could use a filtered dataview for the datagrid's datasource:

Me.dsRecords.ReadXML(filePath)

Dim dv As DataView

dv = dsRecords.Tables(0).DefaultView

dv.RowFilter = "Your Filter Criteria"

dgvRecords.DataSource = dv
dgvRecords.DataMember = "XML"



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top