1,105,578 Community Members

Icons

Member Avatar
Roberdin
Supreme Evil Overlord
282 posts since Feb 2003
Reputation Points: 9 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 0 [?]
Team Colleague
 
1
 

I'm using Visual Basic 6.0 Learning Edition. Does anyone know how to set an Icon for my program (other than the default)? When I click the '...' and then choose an Icon, it claim's I have 'set an Invalid property value'. Can anyone help with this?

Member Avatar
Dani
The Queen of DaniWeb
20,566 posts since Feb 2002
Reputation Points: 1,356 [?]
Q&As Helped to Solve: 931 [?]
Skill Endorsements: 204 [?]
Administrator
Featured
Sponsor
 
0
 

I used to use VB6 for years but now I only have Visual Studio.NET installed, so it's hard for me to remember back and picture what you're seeing.

As far as an icon, you're talking about the little icon that shows up on the top left of the title bar of the application window, right?

Are you sure that you're choosing something that, indeed, is an icon? ;) (sorry, but I just had to ask that one)

The only other thing I can remember (and my experience with VB6 has been nonexistent for years already) is that if you want to put an icon on a command button, even after you choose the icon you want, nothing will change, until you set its style attribute to "graphical".

I'm sure this doesn't apply to application icons though. (Just for the heck of it, I just set up an icon in a Visual Basic.NET application with no problems, and I don't remember having any problems with VB6 either?)

Would you maybe be able to send a screenshot? Or provide some more detailed info ... this is a bit boggling, *IF* we're talking about the same thing!

Member Avatar
Roberdin
Supreme Evil Overlord
282 posts since Feb 2003
Reputation Points: 9 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 0 [?]
Team Colleague
 
0
 

Ok...

Right, I have a .ico file. I want to put this as the program's taskbar icon.

Member Avatar
Dani
The Queen of DaniWeb
20,566 posts since Feb 2002
Reputation Points: 1,356 [?]
Q&As Helped to Solve: 931 [?]
Skill Endorsements: 204 [?]
Administrator
Featured
Sponsor
 
0
 

Well, the taskbar icon is the same as the icon I was talking about ... it just goes to the taskbar when the program is minimized.

I don't understand why this doesn't work. Are you sure you're in the right property field? Do you have a screenshot or ... ?

Member Avatar
Roberdin
Supreme Evil Overlord
282 posts since Feb 2003
Reputation Points: 9 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 0 [?]
Team Colleague
 
0
 

I'm choosing the Icon property.

Member Avatar
Dani
The Queen of DaniWeb
20,566 posts since Feb 2002
Reputation Points: 1,356 [?]
Q&As Helped to Solve: 931 [?]
Skill Endorsements: 204 [?]
Administrator
Featured
Sponsor
 
0
 

What if you tried doing it as a typed command? e.g., on form load, do myForm.icon = myIcon.ico or something along those lines

at least for now, to debug?

Member Avatar
samaru
a.k.a inscissor
1,255 posts since Feb 2002
Reputation Points: 145 [?]
Q&As Helped to Solve: 19 [?]
Skill Endorsements: 30 [?]
Team Colleague
 
1
 

I've had this problem in the past with Visual Basic 5. It's a pain. It was with an icon I created. When I tried another icon, one that came with Visual Basic, it worked fine. Try using another icon and see what happens. I get the feeling that even if you set the icon at runtime, you will get the same error (at least I did). Send me the icon, let me try it on my machine.

If you want to load an icon at runtime, you can try something like this in your form_load():

Form1.Icon = LoadPicture("c:\x.ico")

or wherever you icon is. Let me know how it goes. My e-mail address is in my profile.

Member Avatar
Roberdin
Supreme Evil Overlord
282 posts since Feb 2003
Reputation Points: 9 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 0 [?]
Team Colleague
 
0
 

Cool! Thanks, I'll try that.

Member Avatar
Roberdin
Supreme Evil Overlord
282 posts since Feb 2003
Reputation Points: 9 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 0 [?]
Team Colleague
 
0
 

"Compile Error: Type Mismatch"

Agh!

Member Avatar
samaru
a.k.a inscissor
1,255 posts since Feb 2002
Reputation Points: 145 [?]
Q&As Helped to Solve: 19 [?]
Skill Endorsements: 30 [?]
Team Colleague
 
0
 

The code works for me. Send me the icon.

Member Avatar
archangel
Newbie Poster
6 posts since Jun 2003
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
1
 

ok go to ur main form (the one that will open up first wen ran) then go to properties nd icon u sill see a blank and 3 dots ckil on the 3 dots and find the icon then go to project propersties and go to the tab "make" and then under sections application there will b a lable Icon: clik the down arrow and there will b the default icon and urs clik on urs and ur done.! yay

Member Avatar
Roberdin
Supreme Evil Overlord
282 posts since Feb 2003
Reputation Points: 9 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 0 [?]
Team Colleague
 
0
 

That's what I did to begin with - it didn't work...

Anyway, I solved it now - my icon had the wrong number of colours or something 8)

Member Avatar
samaru
a.k.a inscissor
1,255 posts since Feb 2002
Reputation Points: 145 [?]
Q&As Helped to Solve: 19 [?]
Skill Endorsements: 30 [?]
Team Colleague
 
0
 

Thanks for sending me the icon! ;)

Member Avatar
sendoshin
Light Poster
39 posts since Sep 2006
Reputation Points: 6 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Not to bump an old thread, but the problem in question is caused by a limitation of Visual Basic 6.0 where it only supports .ico files with up to 256 colors. The ICO format, it seems, didn't have support for more than 256 colors until after 1998, when VB6 was released. If an icon you're trying to load gives you the error described above, try reducing the number of colors below 256.

I'm going to install Service Pack 6 again to see if the problem was fixed via the upgrade process. If you see no further comment, even SP6 does nothing to fix this issue. In that case, only upgrading to the latest VB.NET has a chance of working.

Wish me luck!

- Sendoshin

Member Avatar
WaltP
Posting Sage w/ dash of thyme
9,363 posts since May 2006
Reputation Points: 2,905 [?]
Q&As Helped to Solve: 1,151 [?]
Skill Endorsements: 45 [?]
Team Colleague
 
0
 

Not to bump an old thread,

Then why did you?

After three years do you really think he's been waiting for an answer?

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article