I am a user control developer. I use the ToolBoxBitMap attribute to assign an image to my control. But all the examples need hard coding of the image path. This is creating problems if the user deploys the DLL to a different location. Could you please tell me how to assign the image dynamically? I am using VB.NET.
Instead of assigning the toolbox bitmap manually, simply do the following:
- Rename the bitmap to the same first name as the control.
- Add the toolbar bitmap to the solution.
- Select the bitmap in the solution.
- In the bitmap properties, set the Build Action to Embedded Resource.
- In the bitmap properties, set the Custom Tool Namespace to the same namespace your control uses.
Visual Studio .NET will automatically find the bitmap when you add your control to the toolbox.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.