If I properly understood your question, you want to dynamically load and save a background image setting, based on a user choice; the bitmaps to be used are already included in a resource file:
1) Create a Resource file named Resource1.resx
2) Insert bitmaps you want to use (e.g. named "_1", "_2"), in this file
3) In bgdesk, let the code save only the resource name (i.e. "_1", "_2")
4) Add a ComboBox cbImgList
5) Add a Button, which sets the new BackGround image when hit
6) Use the following code (adapt it to your needs)
Private Function GetBackGroundImgFromRes(ByRef sError As String) As Boolean
Try
Dim sImgName As String = My.Settings.bgdesk
If sImgName.Trim <> "" Then
Dim RM As Resources.ResourceManager = My.Resources.Resource1.ResourceManager
Dim objBitmap As Object = RM.GetObject(sImgName)
Me.BackgroundImage = DirectCast(objBitmap, Bitmap)
End If
Return True
Catch ex As Exception
sError = ex.ToString
Return False
End Try
End Function
Private Function SetBackGroundImg(ByRef sError As String) As Boolean
Try
Dim sImgName As String = ""
Select Case cbImgList.SelectedIndex
Case -1
Return True
Case 0
sImgName = "_1"
Case 1
sImgName = "_2"
End Select
Dim RM As Resources.ResourceManager = My.Resources.Resource1.ResourceManager
Dim objBitmap As Object = RM.GetObject(sImgName)
Me.BackgroundImage = DirectCast(objBitmap, Bitmap)
My.Settings.bgdesk = sImgName
Return True
Catch ex As Exception
sError = ex.ToString
Return False
End Try
End Function
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim sError As String = ""
SetBackGroundImg(sError)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
cbImgList.Items.Add("_1")
cbImgList.Items.Add("_2")
Dim sError As String = ""
GetBackGroundImgFromRes(sError)
End Sub