Combobox Using Wrong ToString Method

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Don

    #1

    Combobox Using Wrong ToString Method

    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.C lassName" (e.g. "MyProject.MyCu stomClass") 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/micros...35637a628db41f )
    , 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.


  • tomb

    #2
    Re: Combobox Using Wrong ToString Method

    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:
    [color=blue]
    >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.MyCu stomClass") 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/micros...35637a628db41f )
    >, 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.
    >
    >
    >
    >[/color]

    Comment

    • Don

      #3
      Re: Combobox Using Wrong ToString Method

      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" <tomb@technetce nter.com> wrote in message
      news:Vyq8g.5768 $qd2.4514@bigne ws6.bellsouth.n et...[color=blue]
      >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[/color]


      Comment

      • Don

        #4
        Re: Combobox Using Wrong ToString Method

        For the record, this solution appears to have worked!

        - Don


        "Don" <unknown@oblivi on.com> wrote in message
        news:vos8g.1469 50$WI1.7872@pd7 tw2no...[color=blue]
        > 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" <tomb@technetce nter.com> wrote in message
        > news:Vyq8g.5768 $qd2.4514@bigne ws6.bellsouth.n et...[color=green]
        >>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[/color]
        >
        >[/color]


        Comment

        • Don

          #5
          Re: Combobox Using Wrong ToString Method

          I spoke too soon. The control randomly started ignoring the DataMember
          property and is now doing what it did before. Argh!

          - Don


          "Don" <unknown@oblivi on.com> wrote in message
          news:Bw59g.1548 97$P01.88550@pd 7tw3no...[color=blue]
          > For the record, this solution appears to have worked!
          >
          > - Don[/color]


          Comment

          • Don

            #6
            Re: Combobox Using Wrong ToString Method

            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" <unknown@oblivi on.com> wrote in message
            news:7i69g.1557 95$WI1.63572@pd 7tw2no...[color=blue]
            >I spoke too soon. The control randomly started ignoring the DataMember
            >property and is now doing what it did before. Argh!
            >
            > - Don
            >
            >
            > "Don" <unknown@oblivi on.com> wrote in message
            > news:Bw59g.1548 97$P01.88550@pd 7tw3no...[color=green]
            >> For the record, this solution appears to have worked!
            >>
            >> - Don[/color]
            >
            >[/color]


            Comment

            Working...