Results 1 to 3 of 3

Thread: [RESOLVED] Background Image Problem

  1. #1

    Thread Starter
    Junior Member thekoolgeek's Avatar
    Join Date
    Jan 2006
    Location
    Omaha, NE
    Posts
    20

    Resolved [RESOLVED] Background Image Problem

    I am having problems with the following code. I want to make it so that when the user hovers over the button, the background image changes. Any help is appreciated. Thanks.

    VB Code:
    1. Private Sub btnUpload_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.MouseHover
    2.         Dim strBg As Image
    3.  
    4.         strBg = Application.StartupPath & "\btnbg.jpeg"
    5.  
    6.         btnUpload.BackgroundImage = strBg
    7.     End Sub

  2. #2
    Hyperactive Member BrendanDavis's Avatar
    Join Date
    Oct 2006
    Location
    Florida
    Posts
    492

    Re: Background Image Problem

    You're declaring strBg as an image, but you're setting it to a string. You need to do something like:

    VB Code:
    1. Dim imgPath As System.Drawing.Image = Image.FromFile("C:\Whatever.gif")
    2. PictureBox1.Image = imgPath

    Edit* for accuracy's sake ;D
    God put me on this earth to do many great things, and I'm so far behind that I'm going to live forever.

    I'm programming for Windows using a Apple Mac Mini, 1.5Ghz with 512MB DDR RAM. I feel like I'm committing a crime :P

  3. #3

    Thread Starter
    Junior Member thekoolgeek's Avatar
    Join Date
    Jan 2006
    Location
    Omaha, NE
    Posts
    20

    Re: Background Image Problem

    Thanks, it works now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width