Display Image in userform listbox classModule

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,216
Office Version
  1. 2016
Hi again,
I am a little stuck again... and hope someone could let me know how to set following up.

I have a class module and a userform the code so far is working but now I am stuck with getting a listbox to display images after selection of option group in the userform.

With a normal module perviously I was able to display the images when I am selecting the options ..
But how can I do the same with a class module?
I tried different things but not been able to get it to work.

Hope someone could get me started on this.

Thanks for any help!

Albert
 
Last edited:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
can you post your userform code please
 
Upvote 0
Hi Diddi,
thank you for your answer here is what I have tried but not working..
This code I had in my clsModul...

'Property Get Image() As Object
Code:
'    Select Case m_Image
'        Case BalkonDeckart.beidseitig
'        Image = LoadPicture("Y:\Office\DB_Bilder\Beidseitig.jpg")
'        Case BalkonDeckart.einseitig
'        Image = LoadPicture("Y:\Office\DB_Bilder\Einseitig.jpg")
'        Case BalkonDeckart.keinen
'        Image = LoadPicture("Y:\Office\DB_Bilder\Einseitig.jpg")
'    End Select
'End Property

What I am trying is to select an option in the userform and then display the appropiate picture in the listbox...

this I tried in the userform....

Code:
'Private Sub optBoth_Click()
'    lstAbstaende = LoadPicture("Y:\Office\DB_Bilder\Beidseitig.jpg")
'End Sub
'
'Private Sub optNone_Click()
'    frmBalkonEingabe.lstAbstaende = LoadPicture("Y:\Office\DB_Bilder\Keine.jpg")
'End Sub
'
'Private Sub optOne_Click()
'    lstAbstaende = LoadPicture("Y:\Office\DB_Bilder\Einseitig.jpg")
'End Sub

imgAbstaende is the lstAbstaende is the list box...
as you can see I have tried different code again without luck.

What I can still not quite understand is what needs to be in the class module and what in the module or frmmodule...
Do I need a varible in the classmodule for the image or better the listbox??

Have been looking up different tutorials but all I have found is using classmoduls with normal moduls and always just debug.print .....
So it is still a bit hard to understand how to fit it all together.

Thanks for any help"

Cheers
Albert
 
Upvote 0
Hi again,
the code above is a image box not a listbox had a wrong name for it so that is why I wrote that it should be displayed in a listbox..

sorry of course it is a image box not listbox!!
Just for your info...

Cheers
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top