• 0

[VB.NET] ValueMember of ListBox


Question

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in system.drawing.dll

Additional information: E:\VS.NET 2003 Proekti\Ucenje\binslika

This above is an error that appears after i run the project .... so my intention is to retrieve the path string from DB and regard to path load image within PictureBox1

So i have code like this below:

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        Dim variable1 As String = ListBox1.ValueMember.ToString
        PictureBox1.Image = Image.FromFile(Application.StartupPath & variable1)
    End Sub

Ordinarily, i apply valueMember to ListBox i.e. Me.ListBox1.ValueMember = "slika" 'slika is column with paths

but it still doesn't work .... my paths in db looks like this one "\pic\image1.jpg"

Note: Sure that I have done Connection, DataAdapter and DataSet and ListBox normaly gets and shows the records but PicBox not .... otherwise, if i try to load image with local command like:

PictureBox1.Image = Image.FromFile(Application.StartupPath & "\pic\image1.jpg")

It works perfectly good .... so where i'm wrong ... thanks for any help

Sorry for my bad english

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.