Click here to Skip to main content
15,917,793 members
Home / Discussions / C#
   

C#

 
AnswerRe: Help... ...please? Pin
Judah Gabriel Himango17-May-05 9:53
sponsorJudah Gabriel Himango17-May-05 9:53 
GeneralError Pin
StephenMcAllister17-May-05 8:58
StephenMcAllister17-May-05 8:58 
GeneralRe: Error Pin
Roger Stewart17-May-05 9:08
professionalRoger Stewart17-May-05 9:08 
GeneralRe: Error Pin
StephenMcAllister17-May-05 9:23
StephenMcAllister17-May-05 9:23 
GeneralRe: Error Pin
Tom Larsen17-May-05 12:27
Tom Larsen17-May-05 12:27 
GeneralAdding Icons Pin
Member 156189417-May-05 6:39
Member 156189417-May-05 6:39 
GeneralRe: Adding Icons Pin
Marc Clifton17-May-05 7:44
mvaMarc Clifton17-May-05 7:44 
GeneralRe: Adding Icons Pin
Dave Kreskowiak17-May-05 9:57
mveDave Kreskowiak17-May-05 9:57 
Your code should never assume that the current directory will never change. That's what happening after your file dialog closes. It's changed the current directory.

Let me guess, the value of imageFolder is just a directory name and not a full path?

You should be building a complete full path to any file that your application attempts to get. You could easily accomplish your posted task by creating a small method that returns the full path to the imageFolder directory:
public string GetImageFolderPath()
{
    return Path.Combine(Application.StartupPath, imageFolder);
}

Even better, have your function build the complete path to the image file:
public string GetPathToImageFile(string filename)
{
    return Path.Combine( Path.Combine(Application.StartupPath, imagefolder), filename);
}

Then all you have to do in your posted code is:
myImageList.Images.Add( new Icon( GetPathToImageFile("button.ico") ) );



RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

Questionwhere do i wrong with registry key? Pin
Sasuko17-May-05 6:18
Sasuko17-May-05 6:18 
AnswerRe: where do i wrong with registry key? Pin
leppie17-May-05 6:24
leppie17-May-05 6:24 
GeneralRe: where do i wrong with registry key? Pin
Sasuko17-May-05 6:29
Sasuko17-May-05 6:29 
GeneralRe: where do i wrong with registry key? Pin
Sasuko17-May-05 6:36
Sasuko17-May-05 6:36 
AnswerRe: where do i wrong with registry key? Pin
OMalleyW17-May-05 6:28
OMalleyW17-May-05 6:28 
GeneralConvert byte array to bits Pin
Asad Hussain17-May-05 6:04
Asad Hussain17-May-05 6:04 
GeneralRe: Convert byte array to bits Pin
Marc Clifton17-May-05 7:42
mvaMarc Clifton17-May-05 7:42 
GeneralRe: Convert byte array to bits Pin
Asad Hussain17-May-05 8:46
Asad Hussain17-May-05 8:46 
GeneralRe: Convert byte array to bits Pin
Marc Clifton18-May-05 2:09
mvaMarc Clifton18-May-05 2:09 
GeneralRe: Convert byte array to bits Pin
Robert Rohde17-May-05 11:26
Robert Rohde17-May-05 11:26 
Generalfeedback Pin
niansah17-May-05 4:54
niansah17-May-05 4:54 
GeneralRe: feedback Pin
Robert Rohde17-May-05 4:59
Robert Rohde17-May-05 4:59 
GeneralRe: feedback Pin
niansah17-May-05 5:03
niansah17-May-05 5:03 
GeneralRe: feedback Pin
Colin Angus Mackay17-May-05 5:48
Colin Angus Mackay17-May-05 5:48 
GeneralReading all particular nodes with loop Pin
ksanju100017-May-05 3:23
ksanju100017-May-05 3:23 
GeneralRe: Reading all particular nodes with loop Pin
Marc Clifton17-May-05 3:34
mvaMarc Clifton17-May-05 3:34 
GeneralRe: Reading all particular nodes with loop Pin
mav.northwind17-May-05 3:52
mav.northwind17-May-05 3:52 

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.