Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2005

Tip: Looking for answers? Try searching our database.

Bug or what?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AlexS - 10 Jul 2005 23:53 GMT
I have form with one of tabpages having 2 listboxes and 2 combo boxes.
I load them using DataSource property in initializer - by default. I just
assign DataViews, which are built from underlying DataTables. So, I have 4
different tables where I get data from.

Strange thing happened. While all boxes were unsorted everything was fine.
Then I got from one of table unsorted data and thought to make it easier for
user - set all boxes, list and combo, to sorted. And I got exceptions in
both listboxes. Collection can't be modified - something like that
exception, which you see usually when trying to remove item from collection
while doing for each. Strange thing - it happened on listbox EndUpdate calls
in both cases. According to stack trace - somewhere inside framework, which
checks data source inside Sort method call.

When I set Sorted = false on both listboxes (removed Sorted = true) and left
combos sorted exceptions disappeared.

I run Net 1.1 SP1.

Looks like behavior of combos is quite different from listboxes in respect
of sorting.

Now I wonder and ponder - is that something related to 1.1 or I am doing
something wrong?

Just a Q
Tim Wilson - 11 Jul 2005 02:08 GMT
When using data binding you should perform your sorting through the
DataView. An indication of this is given in the description of the
"ArgumentException" exception of the ComboBox Sorted property.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwindowsformscomboboxclasssortedtopic.asp


Signature

Tim Wilson
.Net Compact Framework MVP

> I have form with one of tabpages having 2 listboxes and 2 combo boxes.
> I load them using DataSource property in initializer - by default. I just
[quoted text clipped - 22 lines]
>
> Just a Q
AlexS - 11 Jul 2005 02:34 GMT
Thanks

Sort of explains.

But exceptions are thrown in listboxes, not in combos. Sorted combos are
eating DataViews ok. Sorted listboxes choke.

How's that in Net 2.0?

> When using data binding you should perform your sorting through the
> DataView. An indication of this is given in the description of the
> "ArgumentException" exception of the ComboBox Sorted property.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwindowsformscomboboxclasssortedtopic.asp


> > I have form with one of tabpages having 2 listboxes and 2 combo boxes.
> > I load them using DataSource property in initializer - by default. I just
[quoted text clipped - 27 lines]
> >
> > Just a Q
Tim Wilson - 11 Jul 2005 02:45 GMT
I've run into this issue before with the ComboBox control in version 1.1 of
the framework. I would assume that the safest thing to do would be to
explicitly handle sorting in the DataView and leave the Sorted property set
to false.

Signature

Tim Wilson
.Net Compact Framework MVP

> Thanks
>
[quoted text clipped - 8 lines]
> > DataView. An indication of this is given in the description of the
> > "ArgumentException" exception of the ComboBox Sorted property.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwindowsformscomboboxclasssortedtopic.asp


> > > I have form with one of tabpages having 2 listboxes and 2 combo boxes.
> > > I load them using DataSource property in initializer - by default. I
[quoted text clipped - 31 lines]
> > >
> > > Just a Q

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.