Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ImageList must be initialized

Have images stored in an imagelist that I want to place in a treeview
control.
Keep getting the message "Image list must be initialized"

Can anyone direct me to a code sample of this?
Can't seem to find anything. I have already added the images that I want
thru the "custom properties" property window.

Thanks

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default ImageList must be initialized

the error message means you need to bind..
it's simple...

Private Sub UserForm_Initialize()
Set Me.TreeView1.ImageList = Me.ImageList1
End Sub

then in your tv s'thin like

TreeView1.Nodes.Item(Index).Image = 2



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"What-a-Tool" wrote:

Have images stored in an imagelist that I want to place in a treeview
control.
Keep getting the message "Image list must be initialized"

Can anyone direct me to a code sample of this?
Can't seem to find anything. I have already added the images that I want
thru the "custom properties" property window.

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ImageList must be initialized

Set Me.TreeView1.ImageList = Me.ImageList1 :gives an error "Invalid object"


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"keepITcool" wrote in message
...
the error message means you need to bind..
it's simple...

Private Sub UserForm_Initialize()
Set Me.TreeView1.ImageList = Me.ImageList1
End Sub

then in your tv s'thin like

TreeView1.Nodes.Item(Index).Image = 2



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"What-a-Tool" wrote:

Have images stored in an imagelist that I want to place in a treeview
control.
Keep getting the message "Image list must be initialized"

Can anyone direct me to a code sample of this?
Can't seem to find anything. I have already added the images that I want
thru the "custom properties" property window.

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default ImageList must be initialized



If you cant solve THAT ..
it may be best to forget using a treeview.,
as I seriously doubt you're going to be able to fill it,
and write proper handling code for the results.


I assumed:
you have a userform..
uf has 1 treeview
uf has 1 imagelist

iml has 2 images (16X16 256 bitmaps or icons)



Private Sub UserForm_Initialize()
With Me.TreeView1
.ImageList = Me.ImageList1
.Nodes.Add , , "key1", "text1", 1
.Nodes.Add , , "key2", "text2", 2
End With
End Sub



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"What-a-Tool" wrote:

Set Me.TreeView1.ImageList = Me.ImageList1 :gives an error "Invalid
object"



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ImageList must be initialized

Yeah - I have a form, I have a treview on it, I have an image list on it ,
and I've got the names straight.
I have my tree view working just fine, thank you. This friggin image list is
drivin me nuts, though.

With Me.tvwMain
Set .ImageList = ilstMain
Set tn = .Nodes.Add(, , strSWDefaultFolder, strFolder, 1, 2)
End With

If I put the Me identifier in front of ilstMain, I get an Invalid Object
error.
If I test as is, I get an "imagelist must be initialized" error

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"keepITcool" wrote in message
...


If you cant solve THAT ..
it may be best to forget using a treeview.,
as I seriously doubt you're going to be able to fill it,
and write proper handling code for the results.


I assumed:
you have a userform..
uf has 1 treeview
uf has 1 imagelist

iml has 2 images (16X16 256 bitmaps or icons)



Private Sub UserForm_Initialize()
With Me.TreeView1
.ImageList = Me.ImageList1
.Nodes.Add , , "key1", "text1", 1
.Nodes.Add , , "key2", "text2", 2
End With
End Sub



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"What-a-Tool" wrote:

Set Me.TreeView1.ImageList = Me.ImageList1 :gives an error "Invalid
object"







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default ImageList must be initialized

you're using

option EXPLICIT ?

you have a Microsoft ImageList Control 6.0 (SP6)
on the form?

you have a Reference to :
Microsoft Windows Common Controls 6.0 (SP6)
(c:\windows\system32\mscomctl.ocx)

(service pack should not be a problem..)


if it's on the form then

typing me.

should popup the controls on the form..
the ilstMain MUST be there!



you've put some icons in the imagelist?
via properties..custom you;ll get the property bag.
Tab 1 must indicate 16x16!
Tab 2 you must add the icons or bitmaps.
16x16 pixels 256 color (or 24 bit)




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"What-a-Tool" wrote:

Yeah - I have a form, I have a treview on it, I have an image list on
it , and I've got the names straight.
I have my tree view working just fine, thank you. This friggin image
list is drivin me nuts, though.

With Me.tvwMain
Set .ImageList = ilstMain
Set tn = .Nodes.Add(, , strSWDefaultFolder, strFolder, 1, 2)
End With

If I put the Me identifier in front of ilstMain, I get an Invalid
Object error.
If I test as is, I get an "imagelist must be initialized" error


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ImageList must be initialized

Ha - Got it figured out - I'm only half as dumb as I was starting to think!

Sorry- I failed to mention that this was a cross post - I wasn't coding this
in Excel. I was thinking of this as a purly VBA question, and there is a lot
of VBA know-how in this group, and the SolidWorks group couldn't help me, so
I thought I might find help here. Just wasn't giving you all the required
info, I suppose.

Had to code in an API call to "mscomctl.ocx".

Drove me nuts - the objects were all there for me, just that nothing worked
the way it was supposed to!

Thanks for the help, and sorry about the cross post


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"What-a-Tool" wrote in message
news:QlBdd.33366$cN6.26387@lakeread02...
Have images stored in an imagelist that I want to place in a treeview
control.
Keep getting the message "Image list must be initialized"

Can anyone direct me to a code sample of this?
Can't seem to find anything. I have already added the images that I want
thru the "custom properties" property window.

Thanks

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Treeview/imagelist problem ravi_cpt Excel Programming 0 July 9th 04 07:40 AM
How to use Treeview control with Imagelist kvenku[_2_] Excel Programming 0 April 7th 04 01:52 PM
Excel: VBA userform is shown but not loaded/initialized even though it was first unloaded? Luisa[_2_] Excel Programming 2 December 5th 03 08:15 AM
listbox value not initialized John Holland Excel Programming 2 November 25th 03 07:57 PM


All times are GMT +1. The time now is 09:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"