vb.net - Specific sorting of a multidimensional array -
i'm translating vba project vb.net. , have little issue sorting of datatable.
my table :
... | ... | firstname3 | name3 | pay3 | firstname1 | name1 | pay1 | firstname2 | name2 | pay2 |... ... | ... | firstname2 | name2 | pay2 | firstname3 | name3 | pay3 | firstname1 | name1 | pay1 |...
and on... export 56 columns needed datatable array , try sort horizontaly on name. did way in vba :
public sub sorttable(byref aggtab(,) object, byval columntosorton integer, byval lowervalue byte, byval uppervalue byte) dim ref object = aggtab((lowervalue + uppervalue) \ 2, columntosorton) dim reflowervalue byte = lowervalue dim refuppervalue byte = uppervalue dim temp object while aggtab(reflowervalue, columntosorton) < ref reflowervalue = reflowervalue + 1 loop while ref < aggtab(refuppervalue, columntosorton) refuppervalue = refuppervalue - 1 loop if reflowervalue <= refuppervalue = lbound(aggtab, 2) ubound(aggtab, 2) temp = aggtab(reflowervalue, i) aggtab(reflowervalue, i) = aggtab(refuppervalue, i) aggtab(refuppervalue, i) = temp next reflowervalue = reflowervalue + 1 : refuppervalue = refuppervalue - 1 end if loop while reflowervalue <= refuppervalue if reflowervalue < uppervalue call sorttable(aggtab, columntosorton, reflowervalue, uppervalue) if lowervalue < refuppervalue call sorttable(aggtab, columntosorton, lowervalue, refuppervalue) end sub
but when convert code vb.net doesn't work properly. can explain me why? because in excel work perfectly.
take example;
dim openwith new sorteddictionary(of string, string) ' add elements dictionary. there no ' duplicate keys, of values duplicates. openwith.add("txt", "notepad.exe") openwith.add("bmp", "paint.exe") openwith.add("dib", "paint.exe") openwith.add("rtf", "wordpad.exe") each ext keyvaluepair(of string, string) in openwith textbox1.appendtext(ext.key & " " & ext.value & vbcrlf) next
this wil automaticly sort 'extension'.
Comments
Post a Comment