C
Cooz
Hi everyone,
I have several .gif images in my Resources folder. I want a user to be able
to select a name in a ComboBox and then have the corresponding .gif displayed
in a PictureBox. I thought this sub would do the trick:
Private Sub KaartenComboBox_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
KaartenComboBox.SelectedIndexChanged
Try
Me.PictureBox1.Image =
System.Drawing.Image.FromFile(Me.KaartenComboBox.Text & ".gif")
Catch ex As Exception
If ex.ToString = "FileNotFoundException" Then
Me.PictureBox1.Image = Me.PictureBox1.ErrorImage
End If
End Try
End Sub
But no: nothing happens. Apparently VB does not look in the resources folder
when I don't provide a path. Which lines of code should I use instead?
I use VB 2005.
Thank you,
Cooz
I have several .gif images in my Resources folder. I want a user to be able
to select a name in a ComboBox and then have the corresponding .gif displayed
in a PictureBox. I thought this sub would do the trick:
Private Sub KaartenComboBox_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
KaartenComboBox.SelectedIndexChanged
Try
Me.PictureBox1.Image =
System.Drawing.Image.FromFile(Me.KaartenComboBox.Text & ".gif")
Catch ex As Exception
If ex.ToString = "FileNotFoundException" Then
Me.PictureBox1.Image = Me.PictureBox1.ErrorImage
End If
End Try
End Sub
But no: nothing happens. Apparently VB does not look in the resources folder
when I don't provide a path. Which lines of code should I use instead?
I use VB 2005.
Thank you,
Cooz