• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

How to Show Custom Icon each of the Forms at Runtime of a Project .

Hi,

I have a project with one mdiform and several forms.

My question is how to show all the forms custom icon at runtime  without have to change all the form's icon.

Thank you.
0
emi_sastra
Asked:
emi_sastra
  • 3
  • 3
1 Solution
 
AkisCCommented:
onLoad form type
Dim ico As New System.Drawing.Icon(myAppPAth & "myDefault.ico")
0
 
emi_sastraAuthor Commented:
Hi,

That mean I have to write it in each of the form ?
Is there any other simple way?

Thank you.
0
 
Priest04Commented:
emi_sastra,

I see that you have placed several questions in the VB.NET area, but you post examples from VB6. They are not the same, and if you ara indeed using VB6, then AkisC advice will be of no help.

VB6

me.icon = loadpicture(icon_path)

if you want to set sane icon for all the forms then you would something like

dim frm as forms
for each frm in forms
    form.icon = loadpicture(icon_path)
next

Its been a long time since I have been used VB6, but I believe it should work.

Goran
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
emi_sastraAuthor Commented:
Hi,

Yes, I know it. I hope I could solve for both (vb6 and vb 2005). I still use vb6 for old app and try to use vb 2005 for new develop app.

It doesn't work.

Thank you.

0
 
Priest04Commented:
Sorry, my mistake, forms collection contains only forms that are alredy loaded. You can either

1) place this code on every form_load
me.icon = loadpicture(icon_path)

2) or have some public procedure that will be executed when loading form

public sub ShowForm(frm as form)
    frm.icon = loadpicture(icon_path)
    frm.show
end sub

I believe there should also be a way through subclassing, but I am not using VB6 anymore, just typing from the head...

Goran
0
 
emi_sastraAuthor Commented:
It works.

Thank you.

0
 
Priest04Commented:
You are welcome

Goran
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now