Stupid VB question...

Started by
12 comments, last by kirkd 19 years, 4 months ago
I have an application which is running fine on the development machine and installs/runs fine on most machines. However, there is one machine on which the application just shuts down after a specific series of actions. I've traced it down to a single line of code which accesses an ImageList object on the VB form. I've seen that there are various problems with MSCOMCTL.ocx on WinXP, but I haven't seen any issues on Win2000. In fact, the machines on which it works are running Win2000 (5.00.2195 SP2) while the machine on which it breaks is running 5.00.2195 SP4). Any tips?? Thanks!!
Advertisement
Could you post the line of code (along with the definition of any types you're using) that is crashing? I may be able to check it out.
Sure, not that it'll help much, but...



Dim Enteris as Long

Enteris = imgList.ListImages.Count



imgList is an ImageList control on the form that has been preloaded with images. I've tested this and any access to the imgList properties/methods causes the shutdown. I've had this line of code, this control in the exact format in this applicaton for over 2 years with no problem. Now, on this one machine I get the issue.

Thanks for the quick reply!!

-Kirk



may want to try changing entries to integer or using CLong() to convert the output of imagelist.count bit, thats all that i can think of, i never had any problems with ms activex controls not working properlly
One more question :)

Could you show me the code you use to load a picture?

[Edited by - alexmoura on December 1, 2004 4:25:13 PM]
Do you mean, to load a picture in general? ie. into a picturebox, or load another picture into your imagelist control?
Whatever is the process you use to load into the imagelist control
Alright, let's say for example my ImageList control is called "imlMain"

In your code where you want to add the images, type:

iml.ListImages.Add , , LoadPicture("C:\Image.bmp")

or if you wanna load the picture from another picture source, like a picturebox or image:

iml.ListImages.Add , , Picture1.Picture

I'm pretty sure that will work. Try it out.

You can also add an index as well, not sure if it's required though.

EDIT: You'll have to add a key probably, so that the picture can be identified correctly. Just play around with the code until it works.

Syntax:
ListImages.Add Index, Key, Picture
Sorry - just tried the following code on a w2k server sp4 machine:
Private Sub Form_Load()    ImageList1.ListImages.Add , , LoadPicture("e:\temp\bitmap.bmp")    ImageList1.ListImages.Add , , LoadPicture("e:\temp\bitmap.bmp")    ImageList1.ListImages.Add , , LoadPicture("e:\temp\bitmap.bmp")        Dim Enteris As Long    Enteris = ImageList1.ListImages.Count        MsgBox EnterisEnd Sub

and it worked fine - which version of the MSCOMCTL.OCX library are you using? (mine is 6.1.95.45)
I use the version that ships with Visual Studio 6 Enterprise Edition, which is probably just 6.0 or something.

This topic is closed to new replies.

Advertisement