I am trying to get a picture to show on a User Form based on the selection from a textbox. Any idea how to get this working right? I can get a picture to show if it was placed in the code from a list box. See sample of code below.
Private Sub ListBox1_Click()
If ListBox1.ListIndex = 0 Then
Image1.Picture = LoadPicture("C:\PartList\29812347.jpg")
End If
If ListBox1.ListIndex = 1 Then
Image1.Picture = LoadPicture("C:\PartList\10012447.jpg")
End If
If ListBox1.ListIndex = 2 Then
Image1.Picture = LoadPicture("C:\PartList\01639267.jpg")
End If
If ListBox1.ListIndex = 3 Then
Image1.Picture = LoadPicture("C:\PartList\30554637.jpg")
End If
End Sub
Private Sub UserForm_Initialize()
With ListBox1
.AddItem "29812347"
.AddItem "10012447"
.AddItem "01639267"
.AddItem "30554637"
End With
End Sub
My problem is that the picture collection of the parts grows every week. The pictures are named with a numerical numbers and are always saved in the same folder. Is it possible to type in a certain part number inside a textbox of the user form and then have it displayed with a command button on the user form inside the image control?
Bookmarks