logo       

Sorting a Listbox in C#: msg#00061

Subject: Sorting a Listbox in C#

OK, I must be doing something really stupid.  I have a listbox that I 
am trying to pupulate from a sorted view, but I can't get it to 
work.  Here is the code that I'm using:

DataView myDV = new DataView(dsFieldList.Tables[0]);
myDV .Sort = "KeyField";
Listbox1.DisplayMember = "FieldName1";
Listbox1.ValueMember = "KeyField";
Listbox1.DataSource = myDV ;

But my Listbox1 seems to be populated in a random order.  What the 
heck am I doing wrong?

Thanks
KRP





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/dpFolB/TM
--------------------------------------------------------------------~-> 

 


<Prev in Thread] Current Thread [Next in Thread>