Hi
OK, you have it sorted. As I spent a little time to compose an example, I will go ahead and post it.
This example uses a DeskTop Folder called TestImages and contains some .jpg files (as per details in comments. There are 2 .jpg files in Resources only, and 1 .jpg file in both Resources and in Folder. All just to demo priorities etc.
I hard coded some names for ComboBox, with all the true files and a couple of non existant files.
Form1 has PictureBox1 and ComboBox1
Option Strict On
Option Explicit On
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' I used random sized images so need
' to make fit the PictureBox
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
' add some names to CB.
' TestImage And NotFound are only
' in Resources
' BOTH image is in Folder and Resources
' Space, ABS LOC and LightHouse are
' only in a File folder
' the others are non existant
' all files have jpg extension
' Resources has first priority
ComboBox1.Items.AddRange({"TestImage", "XYZnotfound", "Space", "ABCnotfound", "BOTH", "Lighthouse LOC", "FGHnotfound", "ABS LOC"})
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim BGimage As Image = Nothing
If My.Resources.ResourceManager.GetObject(ComboBox1.SelectedItem.ToString) IsNot Nothing Then
PictureBox1.Image = CType(My.Resources.ResourceManager.GetObject(ComboBox1.SelectedItem.ToString), Image)
Else
Dim path As String = IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.Desktop, "TestFiles")
Dim fPath As String = IO.Path.Combine(path, ComboBox1.SelectedItem.ToString & ".jpg")
If IO.File.Exists(fPath) Then
PictureBox1.Image = Image.FromFile(fPath)
Else
PictureBox1.Image = My.Resources.NotFound
End If
End If
End Sub
End Class