I have a bitmap ‘b’ and this line is getting me a problem
b.Save(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\result\\img.jpg");
The software breaks at that line.
It is because of the path because when i use this line it works, the bitmap is saved:
b.Save(System.IO.Path.GetDirectoryName("C:\\img.jpg");
Why is the first line not working? I can’t get what the problem is
Change that to
b.Save(Application.StartupPath + "\\img.jpg");The problem here is that
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBasedoesn’t return the executable directory as you might have wanted.