Vb6 下拉列表&;图像盒集成
我有一个简单的表单,其中有一个下拉框,其中有一个姓名列表 上面还有一个图片框 当我在图片中选择一个名称时,我该如何做Vb6 下拉列表&;图像盒集成,vb6,Vb6,我有一个简单的表单,其中有一个下拉框,其中有一个姓名列表 上面还有一个图片框 当我在图片中选择一个名称时,我该如何做 那个人的照片会自动出现在图片框中吗 使用包含名称和图片文件的用户定义类型,然后创建此类型的数组 例如: '1 form with : ' 1 listbox : name=List1 ' 1 picturebox : name=Picture1 Option Explicit Private Type PERSON strName As String str
那个人的照片会自动出现在图片框中吗 使用包含名称和图片文件的用户定义类型,然后创建此类型的数组 例如:
'1 form with :
' 1 listbox : name=List1
' 1 picturebox : name=Picture1
Option Explicit
Private Type PERSON
strName As String
strPicture As String
End Type
Private mperFriend(4) As PERSON
Private Sub Form_Load()
Dim intIndex As Integer
mperFriend(0).strName = "Bob"
mperFriend(0).strPicture = "Bob.jpg"
mperFriend(1).strName = "Jane"
mperFriend(1).strPicture = "Jane.jpg"
mperFriend(2).strName = "Fred"
mperFriend(2).strPicture = "Fred.jpg"
mperFriend(3).strName = "Iris"
mperFriend(3).strPicture = "Iris.jpg"
mperFriend(4).strName = "John"
mperFriend(4).strPicture = "John.jpg"
List1.Clear
For intIndex = 0 To UBound(mperFriend)
List1.AddItem mperFriend(intIndex).strName
Next intIndex
End Sub
Private Sub List1_Click()
Caption = mperFriend(List1.ListIndex).strPicture
Picture1.Picture = LoadPicture(App.Path & "\" & mperFriend(List1.ListIndex).strPicture)
End Sub
在标记中放置了三种不同的VB方言。你到底对哪一个感兴趣?请不要添加不相关的标签。不需要道歉,但删除标签会很有用。我可以通过将图像的文件路径放入组合框来让它工作,但当你点击组合框选择一个人时,它只显示C:\filename等。任何帮助都将是巨大的。您需要某种方式将文件与此人的姓名关联起来。欢迎:)如果对您有效,请将其作为答案接受:)