Click here to Skip to main content
15,917,060 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys

I have a Datagridview which is bound Like so

VB
Dim xmlFile2 As XmlReader
          xmlFile2 = XmlReader.Create("C:\MASTER.xml", New XmlReaderSettings())




          Dim ds2 As New DataSet
          Dim dv2 As DataView
          ds2.ReadXml(xmlFile2)
          dv2 = New DataView(ds2.Tables(0), "InvDesc Like '%" & InvDesc.Text & "%'   ", "QCode", DataViewRowState.CurrentRows)

          DataGridView8.DataSource = dv2

          xmlFile2.Close()


It works fine and it sorts it by "QCode" which is (Numeric / Decimal) column
But it does not sort it properly.
Result:

111.34
35.56
98.80
99.68

Should be:
35.56
98.80
99.68
111.34

I have tried all sorts of ideas and sorting methods
Any suggestions :)
Posted

1 solution

Well, it's obviously not a numeric column, as it's using string comparison to sort the values. :)

It sounds like your XML file doesn't include a schema. Try asking the DataSet to infer one:
VB.NET
ds2.ReadXml(xmlFile2, XmlReadMode.InferTypedSchema)
 
Share this answer
 
Comments
Mario Van Deventer 2-Jul-15 9:18am    
Perfect :)
Thank you so much

Just what it needed.

Can i borrow your Brain for a week or so ?

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