带图片的DataGrid

时间:2013-01-14 03:54:58

标签: vb6

我在Visual Basic 6中有一个DataGrid。这个DataGrid显示了一个产品列表,如下所示: enter image description here

每当用户从DataGrid中选择产品时,我想在Image控件中更改图像。我通过以下代码执行此操作:

Private Sub txtBarcode_Change()
On Error GoTo nosuchfile
    picture.picture = App.Path & "Images\products\" & txtBarcode.Text & ".jpg"
nosuchfile:
picture.picture = App.Path & "Images\products\no_image.jpg"
End Sub

txtBarcode是一个隐藏文本框,其中包含当前在DataGrid中选择的条形码/ ID。

我的问题:图像似乎没有改变。

1 个答案:

答案 0 :(得分:0)

加载你需要调用LoadPicture()

的图片
Picture1.Picture = LoadPicture("c:\temp\pic.bmp")
相关问题