Hello All;
< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
I’ve done everything which I could, but no one was useful. As I found at MSDN I wrote something like this code:
// You should replace the bolded image
// in the sample below with an icon of your own choosing.
// Note the escape character used (@) when specifying the path.
pictureBox1.Image = Image.FromFile
(System.Environment.GetFolderPath
(System.Environment.SpecialFolder.MyPictures)
+ @"\Image.gif");
It doesn’t work as I want, because I should always give nearly the full path.( System.Environment.SpecialFolder. …)
But I’m sure someway should be exist which I can just point to the Image Folder of my application. As we do at any Web Application.(\Images\myicon.ico)
Therefore I just want to know the specific way that I can point to my image folder with out concerning about where my application is located.
Hope you have done this before and can help me.
Thanks.

How can I load an image into picturebox at runtime?
redwyre
picBox_SelectedPhoto.Image.Dispose()
picBox_SelectedPhoto.Image = System.Drawing.Image.FromFile(Environment.CurrentDirectory & "\Blank.JPG")
picBox_SelectedPhoto.Text = "Blank"
Makoto
You are using the special folders which appear to work - I'm not sure why you are using the @ character. I'm using VB not C#
Dim sfoldername As String = System.IO.Directory.GetCurrentDirectory() '//.NET way fo getting current directory Dim sfoldername As String = CurDir() '//Old VB6 way of getting current directory These will reference the special FoldersBut here's some examples
These will reference the application directory or current directory
Dim sFolderName As String = My.Application.Info.DirectoryPath '//Current Application Directory
Dim soldername as string = My.Computer.FileSystem.SpecialDirectories.MyPictures '//VB 2005 way of getting special Folders Dim sfoldername As String = (System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments)) '//Gets Current User My Documents Folder
The Problem you may have is that the Current User MyPictures path is not set. If other special folders are working OK and its just the my pictures that isn't
I noticed this on a Windows 2003 machine. So you may want to check the registry settings to confirm this.
'//May Work - if the My Pictures special Folder path is defined - Check Registry HKEY_Current_User\Software\microsoft\Windows\CurrentVersion\Explorer\ShellFolder\My Pictures Dim sfoldername As String = (System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures))