Home All Groups Group Topic Archive Search About

Combobox Using Wrong ToString Method

Author
10 May 2006 4:38 PM
Don
I have a project wherein I derive a combobox and create a custom Populate()
method for it to fill it with objects of a custom class I also created in a
second project that the combobox project references.  This custom class has
the ToString function overridden to display certain information.

Everything worked fine until one day the combobox started displaying
"AssemblyName.ClassName" (e.g. "MyProject.MyCustomClass") instead of the
appropriate value that the overridden ToString is supposed to return.  It's
like the combobox is using the base Object.Tostring method instead of my
overridden one.

Sometimes the problem goes away after making unrelated changes in the
combobox project and then recompiling it a few times.  However, it will
always suddenly stop working later on.  I suspect this happens after
significant, yet completely unrelated, changes are made to the project that
contains the original custom class (even though the custom class itself is
untouched).

After fiddling around with stuff in the combobox propject it will randomly
start working again.  Even when the temporary changes made in order to bring
about the random 'fix' are undone.  Basically what I'm saying is that this
change in behavior appears to have nothing to do with the code for the
components involved.

This is just driving me crazy.  None of the code that is involved in the
combobox or the class whose objects are used to populated are being modified
at all, yet it randomly stops working properly.

It sounds like someone else had a similar problem (
http://groups.google.ca/group/microsoft.public.dotnet.languages.vb/browse_thread/thread/b86201201e9fd3b/8635637a628db41f?lnk=st&q=%2B%22vb.net%22++%2B%22object.tostring%22&rnum=1&hl=en#8635637a628db41f )
, though this is not exactly the same problem I am having

Has anyone experienced anything like this at all?

- Don

PS: I'm using the 1.1 framework on WinXP SP2 and am manually setting the
versions of all our projects (they have remained static throughout this).  I
suspect a Microsft update is the culprit because this all started happening
after an automatic update was installed (not sure which, though).  Yes I've
tried reinstalling the .NET framework.

Author
10 May 2006 6:45 PM
tomb
I would highly recommned renaming the overriden toString method with
something more speciallized, as this kind of crap from Microsoft will
make you crazy.  I have had similar things happen to me in XP that don't
happen in Win2K, so I do all my development on my Win2K box.  XP is
still too buggy for me, and MS development tools are also.  The combined
effect is killer!

T

Don wrote:

Show quoteHide quote
>I have a project wherein I derive a combobox and create a custom Populate()
>method for it to fill it with objects of a custom class I also created in a
>second project that the combobox project references.  This custom class has
>the ToString function overridden to display certain information.
>
>Everything worked fine until one day the combobox started displaying
>"AssemblyName.ClassName" (e.g. "MyProject.MyCustomClass") instead of the
>appropriate value that the overridden ToString is supposed to return.  It's
>like the combobox is using the base Object.Tostring method instead of my
>overridden one.
>
>Sometimes the problem goes away after making unrelated changes in the
>combobox project and then recompiling it a few times.  However, it will
>always suddenly stop working later on.  I suspect this happens after
>significant, yet completely unrelated, changes are made to the project that
>contains the original custom class (even though the custom class itself is
>untouched).
>
>After fiddling around with stuff in the combobox propject it will randomly
>start working again.  Even when the temporary changes made in order to bring
>about the random 'fix' are undone.  Basically what I'm saying is that this
>change in behavior appears to have nothing to do with the code for the
>components involved.
>
>This is just driving me crazy.  None of the code that is involved in the
>combobox or the class whose objects are used to populated are being modified
>at all, yet it randomly stops working properly.
>
>It sounds like someone else had a similar problem (
>http://groups.google.ca/group/microsoft.public.dotnet.languages.vb/browse_thread/thread/b86201201e9fd3b/8635637a628db41f?lnk=st&q=%2B%22vb.net%22++%2B%22object.tostring%22&rnum=1&hl=en#8635637a628db41f )
>, though this is not exactly the same problem I am having
>
>Has anyone experienced anything like this at all?
>
>- Don
>
>PS: I'm using the 1.1 framework on WinXP SP2 and am manually setting the
>versions of all our projects (they have remained static throughout this).  I
>suspect a Microsft update is the culprit because this all started happening
>after an automatic update was installed (not sure which, though).  Yes I've
>tried reinstalling the .NET framework.
>
>

>
Author
10 May 2006 8:52 PM
Don
That's a good idea.  I'll see if there's a way I can do this with the
combobox's DisplayMember property.  Thanks.

- Don


Show quoteHide quote
"tomb" <t***@technetcenter.com> wrote in message
news:Vyq8g.5768$qd2.4514@bignews6.bellsouth.net...
>I would highly recommned renaming the overriden toString method with
>something more speciallized, as this kind of crap from Microsoft will make
>you crazy.  I have had similar things happen to me in XP that don't happen
>in Win2K, so I do all my development on my Win2K box.  XP is still too
>buggy for me, and MS development tools are also.  The combined effect is
>killer!
>
> T
Author
12 May 2006 7:40 PM
Don
For the record, this solution appears to have worked!

- Don


"Don" <unkn***@oblivion.com> wrote in message
news:vos8g.146950$WI1.7872@pd7tw2no...
Show quoteHide quote
> That's a good idea.  I'll see if there's a way I can do this with the
> combobox's DisplayMember property.  Thanks.
>
> - Don
>
>
> "tomb" <t***@technetcenter.com> wrote in message
> news:Vyq8g.5768$qd2.4514@bignews6.bellsouth.net...
>>I would highly recommned renaming the overriden toString method with
>>something more speciallized, as this kind of crap from Microsoft will make
>>you crazy.  I have had similar things happen to me in XP that don't happen
>>in Win2K, so I do all my development on my Win2K box.  XP is still too
>>buggy for me, and MS development tools are also.  The combined effect is
>>killer!
>>
>> T
>
>
Author
12 May 2006 8:33 PM
Don
I spoke too soon.  The control randomly started ignoring the DataMember
property and is now doing what it did before.  Argh!

- Don


"Don" <unkn***@oblivion.com> wrote in message
news:Bw59g.154897$P01.88550@pd7tw3no...
Show quoteHide quote
> For the record, this solution appears to have worked!
>
> - Don
Author
19 May 2006 6:04 PM
Don
Hmmm...  I changed the function to be a readonly property instead and it
seems to be working.

How very odd.  But at least it appears to work now!

- Don


"Don" <unkn***@oblivion.com> wrote in message
news:7i69g.155795$WI1.63572@pd7tw2no...
Show quoteHide quote
>I spoke too soon.  The control randomly started ignoring the DataMember
>property and is now doing what it did before.  Argh!
>
> - Don
>
>
> "Don" <unkn***@oblivion.com> wrote in message
> news:Bw59g.154897$P01.88550@pd7tw3no...
>> For the record, this solution appears to have worked!
>>
>> - Don
>
>