I'm having the problem with ToolBoxBitmap attribute, and none of the solutions work in my environment.
Also I tried to access bobpowell site, and it does not work.
Do you have a project in wich it works ?
Thanks in advance.
Quote:
quote:Originally posted by Rod Stephens
> Rod, i found it myself (i use me.) is it right?
Exactly.
> <ToolboxBitmap(gettype(Tbox),"Textbox")>_
>
> 'here Tbox is my class
> 'Textbox is the name of the bitmat (I add
> Textbox.bmp into the resources)
This is something Microsoft seems to have really messed up. I have had terrible luck getting this to work.
There's a very informative article at:
http://www.bobpowell.net/toolboxbitmap.htm
But I still have trouble if teh namespace has been changed.
I recommend one of two approaches.
1. Use the other version of the ToolboxBitmap attribute where you pass in the full path to the bitmap file as in:
<ToolboxBitmap("C:\MyCotrols\Tbox\Textbox.bmp")> _
This seems heavy-handed because you'll need to change the code if you move the project but at least it's easy to understand.
2. Ensure that the project's root namespace matches the assembly's name. Double-click My Project, go to the Application tab, and make sure the Assembly Name and Root Namespace match. Then select the resource file in Project Explorer (Textbox.bmp in your case), go to the Properties window, and set Build Action to Embedded Resource. Finally, use a statement like this:
<ToolboxBitmap(GetType(Tbox), "Textbox")> _
What a mess, huh? I haven't had a chance to try anything with the resfinder class suggested in that article.
If anyone has a better more consistent solution, please let me know!
Rod
RodStephens@vb-helper.com
Author of "Visual Basic 2005 Programmer's Reference"
http://www.vb-helper.com/vb_prog_ref.htm
Sign up for the free VB Helper Newsletters at http://www.vb-helper.com/newsletter.html
|