I am trying to put my own icon on a message box using messageboxinderect.
Printable View
I am trying to put my own icon on a message box using messageboxinderect.
Don't.
Add a new form to your project and dress it up to look like a messagebox, with a picture box to put your icon in it.
then add a method to it with all the paramaters you need, and an extra one as an object (Call it OwnerWindow as Object).
in the code for the method put all the code to change the text, the buttons and your icon as a stdPicture etc.
useto set the picturebox icon and show the form withCode:Set pctIcon = Icon
vbModal tells vb to make the window act like a messagebox and the OwnerWindow sets which object to centre the form in so set it to Me when you call it. remember to set the forms startup position to center in owner. it may need some tweeking to get it right but it should work.Code:
me.Show vbModal, OwnerWindow
Hope this helps.