Sorting a datagrigview

  • Thread starter Thread starter =?ISO-8859-15?Q?St=E9phane_Miqueu?=
  • Start date Start date
?

=?ISO-8859-15?Q?St=E9phane_Miqueu?=

Hi,

I sort my datagridview with : dgWrk.Sort(dgWrk.Columns(3),...
and it works perfect. Now, I want it sorted on 2 columns. How did I do
that ? I've try dgWrk.Sort(dgWrk.Columns(3)+dgWrk.Columns(4)+ ...
but I have an error in the code editor.

Thanks
 
Stéphane Miqueu said:
Hi,

I sort my datagridview with : dgWrk.Sort(dgWrk.Columns(3),...
and it works perfect. Now, I want it sorted on 2 columns. How did I do
that ? I've try dgWrk.Sort(dgWrk.Columns(3)+dgWrk.Columns(4)+ ...
but I have an error in the code editor.

Hi Stéphane,

AFAIK, the '+' operator won't work here and the Sort(...) method can
only get 1 column, no collection. Doesn't it work when you just call
dgWrk.Sort(dgWrk.Columns(3))
dgWrk.Sort(dgWrk.Columns(2)) ?

(Maybe you need a dgWrk.update() call between the .sort())
 
Norman Chong a présenté l'énoncé suivant :
Hi Stéphane,

AFAIK, the '+' operator won't work here and the Sort(...) method can
only get 1 column, no collection. Doesn't it work when you just call
dgWrk.Sort(dgWrk.Columns(3))
dgWrk.Sort(dgWrk.Columns(2)) ?

(Maybe you need a dgWrk.update() call between the .sort())

Well done Norman, it was just under my nose. I was doing the sorting in
the wrong order : col3 then col4 whereas col4 THEN col3 is doing just
fine.

Thanks !
 
Back
Top