borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (mmc control)Next Topic (Repair data from damaged CD) New Topic New Poll Post Reply
AndreaVB Forum : Multimedia : recalling image
Poster Message
Thyrosis
Level: Trainee

Registered: 10-11-2005
Posts: 3

icon recalling image

Hello everybody,

I just spend the whole morning and half the afternoon searching the internet and this forum to something I still haven't found, and my final solution was signing up and just asking.

The thing is: I want to create something like a roll-over image in html, but then in vb.net (2003). By hovering the mouse over 3 different buttons, a image should appear next to them buttons and show 3 different images (according to the buttons ofcourse).

What I did is:
put the images in an imagelist;
create 1 picturebox;
create 3 buttons;
Private Sub btn1_MouseHover

and then?
I thought
picBox1.image = imgList1(0)
(first picture is 0, like an array?)
But then I get the blue curvy lines beneath
imgList1(0)
, telling me: "Class 'System.Windows.Forms.Imagelist' cannot be indexed because it has no default property."

What can I do to make it work?

Thanks in advance
Thyrosis

____________________________
Thyrosis
vb.Net student
desperately seeking for answers :p

10-11-2005 at 02:21 PM
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1156
icon Re: recalling image

Sorry aint got dotnet but see below for vb6 code


Set Picture1.Picture = ImageList1.ListImages(1).Picture



Hope it helps

Steve  

10-11-2005 at 03:40 PM
View Profile Send Email to User Show All Posts | Quote Reply
Thyrosis
Level: Trainee

Registered: 10-11-2005
Posts: 3
icon Re: recalling image

Thanks for the reply! I tried it, but gave several errors though.

- dotnet doesnt support Set and Let anymore (atleast, thats what it tells me)
- both .Picture and .ListImages() are not accepted. (I think they use .Image now instead of .Picture)

I've been trying to play around with Steve's help, and got so far already: (I've changed the original imgList1 with ImageList1)

picBox1.Image = ImageList1.ImageCollection(0).image


Again, something is not accepted. ImageList1.ImageCollection receives the curvy lines, saying

quote:
'ImageCollection' is a type in 'System.Windows.Forms.Imagelist' and cannot be used as an expression.


I've also tried to put in an imagestream, but I really don't know what I should do with that, so I ceased trying that.

Do I have to declare ImageList1 as an array? I've tried that as well, but couldn't figure out to do that.

Thanks again,
Thyrosis

____________________________
Thyrosis
vb.Net student
desperately seeking for answers :p
11-11-2005 at 09:36 AM
View Profile Send Email to User Show All Posts | Quote Reply
GeoffS
Level: VB Lord


Registered: 29-09-2004
Posts: 536
icon Re: recalling image

Try this :

Dim x As Integer = 0
      'x is the index of the image in the list

picBox1.Image = imageList1.Images(x)



____________________________
multi-tasking - the ability to hang more than one app. at the same time.

11-11-2005 at 10:03 AM
View Profile Send Email to User Show All Posts | Quote Reply
Thyrosis
Level: Trainee

Registered: 10-11-2005
Posts: 3
icon Re: recalling image

Jolly Good! That solved the problem! Thanks alot!  



Although now another problem rises. The picture changes when I hoover the mouse over the button (as it should do). But it doesn't changes back to the original picture as soon as it leaves the button... So I'm looking for that now. Probably something in the Btn1.MouseLeave

Thanks again mate!

____________________________
Thyrosis
vb.Net student
desperately seeking for answers :p

12-11-2005 at 04:00 PM
View Profile Send Email to User Show All Posts | Quote Reply
NeNsEc
Level: Protégé

Registered: 05-12-2005
Posts: 4
icon Re: recalling image

Hmm, i hav sumsort of same problem:
When the user clicks on a record in lstData then it opens a new form whit more info about the record the user clicked on it. But it should also load a picture, hers my code:

(I cut everything away except for the picture part)


Private Sub lstData_Click()
...
On Error Resume Next
Set frmDataW.picWeapon.Picture = App.Path & "\Icons\Axe\" & rs("Picture") & ".jpg"
End Sub


Any ideas what im doing wrong? The rest works, the labels.

07-12-2005 at 07:30 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Multimedia : recalling image
Previous Topic (mmc control)Next Topic (Repair data from damaged CD) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder