Ghost images??

Discussion in 'Questions (Windows Mobile)' started by HARRY, Jan 24, 2009.

  1. HARRY

    HARRY Active Member Licensed User


    A program running on the PDA opens via the Show method another form, say the ViewForm. On the Show event in the ViewForm a circle is drawn and via AddImageButton 20 buttons are created. The Image property is not used, just the Text property and the Transparent property (true). Based on GPS data the position of the imagebuttons is changed via the Left and Top property, using a timer. This runs fine.

    Now the user leaves that form via the Close method. Somewhat later on the user opens again that ViewForm. The circle is drawn again and the image buttons are newly created and again positioned based on GPS data.

    However, also the image buttons which were shown on the moment of closing the ViewForm are shown on the 'old' positions. The new buttons are repositioned based on GPS data; the old ones stay where they are.

    When closing the form, I assume that the image buttons are destroyed as they can be recreated without an error message that they exist already.
    Should I clear the form before the close? But How?

    Am I doing something wrong?

    I cannot test it on the PC as I have no separate GPS device.

    Please, can somebody help me?

  2. Cableguy

    Cableguy Expert Licensed User

    You assume wrong...You must dispose of all the newly created controld before creating them again...
    Or re-use them, cahnging they caption and position...
  3. HARRY

    HARRY Active Member Licensed User

    Hi Paulo,

    Thanks for your helpfull reply. Indeed, after disposing the buttons when closing the form it works as it should do.

    Apparently , when closing without disposing, the buttons are no longer in the 'administration', as I can create them again with the same name and numbers, but they are still visible.

    Anyhow, thanks,

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice