Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

string filepath to picturebox.image wont work in VB2010

$
0
0

I am trying to change the image in a picturebox depending on what label is hovered over. so ive named the pictures with the imagename in them.
Private Sub lbls_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblDoctC.MouseHover, _
        lblCanaS.MouseHover, LblCanaSSide.MouseHover, LblChocS.MouseHover, lblCybeS.MouseHover
      

        'this bit gets the fours letters corresponding to the image name in the filepath
        Dim pic As String = sender.name.substring(3, 4)
        Dim hovered As String = Application.StartupPath & "\logic\" & pic & ".jpg"

        'this bit is supposed to get the picturebox to equal the filepath "hovered"
        picHover.Image = hovered

    End Sub

however, i get the error on the '= hovered' that says   "Value of type string cannot be converted to 'system.drawing.image'"

I've tried with my.resources (that wont let me use the & for the 'pic' value)
Any and all help would be nice

           

Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>