Click here to Skip to main content
16,005,209 members
Home / Discussions / C#
   

C#

 
AnswerRe: Node List Problem Pin
Ravi Bhavnani17-Nov-07 16:47
professionalRavi Bhavnani17-Nov-07 16:47 
QuestionTreeView Images (Image Array) Pin
Jeffrey Walton17-Nov-07 10:17
Jeffrey Walton17-Nov-07 10:17 
QuestionRe: TreeView Images (Image Array) Pin
Jeffrey Walton17-Nov-07 11:04
Jeffrey Walton17-Nov-07 11:04 
QuestionRe: TreeView Images (Image Array) Pin
Jeffrey Walton17-Nov-07 12:10
Jeffrey Walton17-Nov-07 12:10 
AnswerRe: TreeView Images (Image Array) Pin
Jeffrey Walton17-Nov-07 22:34
Jeffrey Walton17-Nov-07 22:34 
AnswerRe: TreeView Images (Image Array) Pin
Luc Pattyn17-Nov-07 12:56
sitebuilderLuc Pattyn17-Nov-07 12:56 
GeneralRe: TreeView Images (Image Array) Pin
Jeffrey Walton17-Nov-07 13:04
Jeffrey Walton17-Nov-07 13:04 
GeneralRe: TreeView Images (Image Array) Pin
Luc Pattyn18-Nov-07 1:26
sitebuilderLuc Pattyn18-Nov-07 1:26 
Hi Jeff,

I've got your TreeViewImageHelper class up and running. Here are some comments:

- when the resource is not found, you catch an exception, ignore it, and return null
in GetEmbeddedFile(); the minimum you should add is some code to log the exception;
that way, you will probably see none of your resources get loaded.
} catch(Exception exc) {
    log(exc.ToString());
    return null;
}

where log(string s) could be as simple as Console.WriteLine(s);

- the most likely reason is you must add the images to the Visual Studio project,
set their property "Build Action" to "Embedded Resource", but also make sure they are
located where your code looks for them, in your case in a folder named "Resources"
(do an "Add Folder" in the Solution pane, and drag the image files in it), because that
is the consequence of assemblyname + ".Resources" + "." + filename
warning: the folder name is case-sensitive!

- you could drop the null in filenames, and replace the for by a foreach:
foreach(string filename in filenames) {...}

- IMO you can simplify the assembly/assemblyname stuff in GetEmbeddedFile() to:
if(null == assemblyname) {
    assembly=Assembly.GetExecutingAssembly();
    assemblyname = assembly.GetName().Name;
    log("assemblyname ="+assemblyname);
}


Regards,


Luc Pattyn [Forum Guidelines] [My Articles]


this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets


GeneralRe: TreeView Images (Image Array) Pin
Jeffrey Walton18-Nov-07 2:56
Jeffrey Walton18-Nov-07 2:56 
QuestionFolderBrowser exception Pin
martin_hughes17-Nov-07 9:14
martin_hughes17-Nov-07 9:14 
AnswerRe: FolderBrowser exception Pin
Luc Pattyn17-Nov-07 9:53
sitebuilderLuc Pattyn17-Nov-07 9:53 
GeneralRe: FolderBrowser exception Pin
martin_hughes17-Nov-07 10:28
martin_hughes17-Nov-07 10:28 
QuestionList of Network Connection Pin
Muhammad Nauman Yousuf17-Nov-07 8:02
Muhammad Nauman Yousuf17-Nov-07 8:02 
Questionopen file for writing text(not bytes) and share access Pin
gizmokaka17-Nov-07 7:42
gizmokaka17-Nov-07 7:42 
AnswerRe: open file for writing text(not bytes) and share access Pin
Giorgi Dalakishvili17-Nov-07 8:01
mentorGiorgi Dalakishvili17-Nov-07 8:01 
GeneralRe: open file for writing text(not bytes) and share access Pin
gizmokaka17-Nov-07 8:08
gizmokaka17-Nov-07 8:08 
GeneralRe: open file for writing text(not bytes) and share access Pin
Giorgi Dalakishvili17-Nov-07 8:20
mentorGiorgi Dalakishvili17-Nov-07 8:20 
GeneralRe: open file for writing text(not bytes) and share access Pin
Giorgi Dalakishvili17-Nov-07 9:48
mentorGiorgi Dalakishvili17-Nov-07 9:48 
GeneralRe: open file for writing text(not bytes) and share access Pin
gizmokaka17-Nov-07 8:40
gizmokaka17-Nov-07 8:40 
GeneralRe: open file for writing text(not bytes) and share access Pin
Luc Pattyn18-Nov-07 1:34
sitebuilderLuc Pattyn18-Nov-07 1:34 
GeneralRe: open file for writing text(not bytes) and share access Pin
Giorgi Dalakishvili17-Nov-07 9:56
mentorGiorgi Dalakishvili17-Nov-07 9:56 
GeneralRe: open file for writing text(not bytes) and share access Pin
gizmokaka17-Nov-07 10:20
gizmokaka17-Nov-07 10:20 
GeneralRe: open file for writing text(not bytes) and share access Pin
gizmokaka17-Nov-07 12:31
gizmokaka17-Nov-07 12:31 
QuestionProblem Getting C# BHO To Work Pin
Khoramdin17-Nov-07 6:10
Khoramdin17-Nov-07 6:10 
AnswerRe: Problem Getting C# BHO To Work Pin
Not Active17-Nov-07 11:35
mentorNot Active17-Nov-07 11:35 

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.