xml - Alphabetizing query info in a listview (Visual Basic) -
i'm doing programming file in queried names, abbreviations, population, , area of 50 states in xml file. trying output data listview control each element going respective column (name goes in column name etc). can names alphabetized using "order name ascending" within query, abbreviations , other info doesn't fall in order names. tried order other data name did nothing @ all. example of name query
dim querystates = state in states.descendants("state") let name = state.<name>.value order name ascending select name namearr = querystates.toarray dim querystates2 = state in states.descendants("state") let abb = state.<abbreviation>.value order name ascending select abb abbarr = querystates2.toarray dim querystates3 = state in states.descendants("state") let area = state.<area>.value order name ascending select area areaarr = querystates3.toarray dim querystates4 = state in states.descendants("state") let pop = state.<population>.value order name ascending select pop poparr = querystates4.toarray here try output data, names alphabetized fine, none of other data is. temp string variable, currentstate string array length=3 itm listview item, , lstvw_statechrt listview control 4 coloumns
x integer = 0 49 temp = namearr(x) & "," & abbarr(x) & "," & areaarr(x) & "," & poparr(x) currentstate = temp.split(",") itm = new listviewitem(currentstate) lstvw_statechrt.items.add(itm) next so question have suggestions on way this?
this in c#:
var query = states.descendants("state") .select(s=> new { name=s.<area>.value, pop = s.<population>.value, abb = s.<abbreviation>.value, area = s.<area>.value }) .orderby(s=>s.name); let's see online c# vb converter comes with:
dim query = states.descendants("state").[select](function(s) new { _ key .name = s.area.value, _ key .pop = s.population.value, _ key .abb = s.abbreviation.value, _ key .area = s.area.value _ }).orderby(function(s) s.name)
Comments
Post a Comment