Click here to Skip to main content
15,921,113 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# and database Pin
Heath Stewart16-Apr-04 10:33
protectorHeath Stewart16-Apr-04 10:33 
GeneralRe: C# and database Pin
ingramj17-Apr-04 15:14
ingramj17-Apr-04 15:14 
GeneralBinary Data in Data Grid :: C# Pin
valikac16-Apr-04 9:04
valikac16-Apr-04 9:04 
GeneralRe: Binary Data in Data Grid :: C# Pin
Heath Stewart16-Apr-04 9:08
protectorHeath Stewart16-Apr-04 9:08 
GeneralRe: Binary Data in Data Grid :: C# Pin
valikac16-Apr-04 11:08
valikac16-Apr-04 11:08 
GeneralRe: Binary Data in Data Grid :: C# Pin
Heath Stewart16-Apr-04 11:12
protectorHeath Stewart16-Apr-04 11:12 
QuestionToolboxBitmap problem??? Pin
Small Rat16-Apr-04 8:49
Small Rat16-Apr-04 8:49 
AnswerRe: ToolboxBitmap problem??? Pin
Heath Stewart16-Apr-04 10:24
protectorHeath Stewart16-Apr-04 10:24 
The best way is to make sure it always exists. Embed the image as an embedded resource in your project (change the Build Action to "Embedded Resource" in the project after adding the image to your project if you haven't already).

Then, in the ToolboxBitmapAttribute, you have a couple options. If it uses the same namespace and name as a class and has the .bmp extension (so a Windows bitmap), then you can simply specify the type of the class that's named like it using [ToolboxBitmap(typeof(MyClass))]. If it simply shares the same namespace, you can use [ToolboxBitmap(typeof(MyClass), "SomeImage.bmp")]. If you want to worry about having to the deploy the image as well, you can just specify the name like [ToolboxBitmap("SomeImage.bmp")]. The former two ways are much better and will ensure that your image always exists.

BTW, the namespace of the image is obtained using the root namespace of your project (defaults to the project name) plus any folders it might be in within your project. These folders will also cause VS.NET to use the same scheme to create a namespace for your classes that you add to your project/folder, but moving that source file will not automatically change its namespace. It will for embedded resources, though.

 

Microsoft MVP, Visual C#
My Articles
General"Go To Error/Tag" and F4 Pin
RNEELY16-Apr-04 6:57
RNEELY16-Apr-04 6:57 
GeneralRe: "Go To Error/Tag" and F4 Pin
garythom_work16-Apr-04 7:31
garythom_work16-Apr-04 7:31 
GeneralRe: "Go To Error/Tag" and F4 Pin
RNEELY16-Apr-04 8:15
RNEELY16-Apr-04 8:15 
GeneralRe: "Go To Error/Tag" and F4 Pin
Heath Stewart16-Apr-04 7:48
protectorHeath Stewart16-Apr-04 7:48 
GeneralRe: "Go To Error/Tag" and F4 Pin
RNEELY16-Apr-04 8:16
RNEELY16-Apr-04 8:16 
GeneralRe: "Go To Error/Tag" and F4 Pin
partyganger16-Apr-04 10:50
partyganger16-Apr-04 10:50 
Generalobject scope and destruction Pin
poolboy16-Apr-04 6:44
poolboy16-Apr-04 6:44 
GeneralRe: object scope and destruction Pin
Dave Kreskowiak16-Apr-04 6:56
mveDave Kreskowiak16-Apr-04 6:56 
GeneralRe: object scope and destruction Pin
poolboy16-Apr-04 7:31
poolboy16-Apr-04 7:31 
GeneralRe: object scope and destruction Pin
Heath Stewart16-Apr-04 7:49
protectorHeath Stewart16-Apr-04 7:49 
GeneralRe: object scope and destruction Pin
Dave Kreskowiak16-Apr-04 8:16
mveDave Kreskowiak16-Apr-04 8:16 
GeneralRe: object scope and destruction Pin
scadaguy16-Apr-04 7:49
scadaguy16-Apr-04 7:49 
GeneralRe: object scope and destruction Pin
PaleyX26-May-04 11:03
PaleyX26-May-04 11:03 
Questionsystem string size? Pin
Anonymous16-Apr-04 6:24
Anonymous16-Apr-04 6:24 
AnswerRe: system string size? Pin
Heath Stewart16-Apr-04 6:29
protectorHeath Stewart16-Apr-04 6:29 
AnswerRe: system string size? Pin
Jeroen Landheer16-Apr-04 10:34
Jeroen Landheer16-Apr-04 10:34 
Generaltab control slow Pin
robmays16-Apr-04 5:47
robmays16-Apr-04 5:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.