Results 1 to 13 of 13

Thread: Change form icon

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Change form icon

    I'm trying to change the form icon so that my taskbar icon changes. I'm using the following code:
    VB Code:
    1. Me.Icon = App.Path & "\clear.ico"
    and I'm getting a "type mismatch" error on the ampersand. Is this not a legal path for the icon?
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    I think you need to load it as a picture first...

    MyVar = LoadPicture(App.Path & "\clear.ico")

    Me.Icon = MyVar

    Just a guess
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  3. #3

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Nope.... that didn't do it.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  4. #4
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392
    Well, the reason is that you don't LoadPicture into a variable
    Just:
    Form1.Icon = LoadPicture(imgPath)

    cjqp
    When your answer is the Arc Sin of 1.015, you should check your Pythagorean triple.

  5. #5
    Fanatic Member laserman's Avatar
    Join Date
    Jan 2002
    Location
    Wales U.K
    Posts
    775
    why dont you just change the icon in the propertys box of the form to whatever icon you want.


    Is this what you were looking for?


    Cheers

  6. #6

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Originally posted by laserman
    why dont you just change the icon in the propertys box of the form to whatever icon you want.


    Is this what you were looking for?


    Cheers
    Because I'm changing it at runtime.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  7. #7

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Ok, cjqp's suggestion worked, but the icon in the taskbar does not get updated. Is there a way to refresh the taskbar?
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  8. #8
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Have you tried making it invisible and visible straight after?
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  9. #9
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392
    It depends on how you are adding the icon to the taskbar, whether by your own code or by a 3rd party control. Some controls will automatically update the taskbar icon, some will not. You could remove/add the icon again to the taskbar to update the icon.

    cjqp
    When your answer is the Arc Sin of 1.015, you should check your Pythagorean triple.

  10. #10

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    I'm using my own code... the code that is posted all the time for using system tray icons.

    And no, I haven't tried making it visible/invisible.

    Maybe I'll just add this in the next release. It's only going to change the icon for a split second anyways.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  11. #11
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392
    I don't know much about adding icons to the sys tray, but I don't think making it invisible/visible will help. But like I said, I don't know that aspect.

    cjqp
    When your answer is the Arc Sin of 1.015, you should check your Pythagorean triple.

  12. #12

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    I didn't think that would work either... probably why I haven't attempted to do it.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  13. #13
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392
    But removing the icon and re-adding it would work. Shouldn't be to hard if you have good code, just function calls.

    cjqp
    When your answer is the Arc Sin of 1.015, you should check your Pythagorean triple.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width