In my VB.net (2012) program, I defined some resources. I did this by right-clicking on the project name in the Solution Explorer window and choosing properties. From there, I picked the Resources tab the Add Resources -> Add Existing File. I also have the following code:

In the class, but before any routines:
Code:
Structure imInfo
    Dim strName As String
    Dim brPtr As Bitmap
End Structure

Dim aryInfo(6) As imInfo
In the form’s Load routine:
Code:
aryIno(0).strName = "name1"
aryIno(0).brPtr = My.Resources.name1
aryIno(1).strName = "name2"
aryIno(1).brPtr = My.Resources.name2
In a button click routine:
Code:
For t = 0 To cntImages
    images(t).strFName = <entered string>
    images(t).bm = getBMfromName(images(t).strFName)
Next
And the routine called:
Code:
Private Function getBMfromName(ByVal resName As String) As Bitmap
    For i = 0 To 6
        If aryIno(i).strName = resName Then
            getBMfromName = aryIno(i).brPtr
            Exit Function
        End If
    Next
End Function
The code works just fine and the aryInfo array only has seven elements and is unlikely to change. However, the manner in which I did this strikes me as being both ugly and inefficient. Is there a better/cleaner way to accomplish this?