# Stupid VB question...

This topic is 4762 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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!!

##### Share on other sites
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.

##### Share on other sites
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.

-Kirk

##### Share on other sites
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

##### Share on other sites
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]

##### Share on other sites
Do you mean, to load a picture in general? ie. into a picturebox, or load another picture into your imagelist control?

##### Share on other sites
Whatever is the process you use to load into the imagelist control

##### Share on other sites
Alright, let's say for example my ImageList control is called "imlMain"

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

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:

##### Share on other sites
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)

##### Share on other sites
I use the version that ships with Visual Studio 6 Enterprise Edition, which is probably just 6.0 or something.

##### Share on other sites
you may want to try to install sp6 for visual studio - it is possible you're hitting an error that was later fixed:

(btw, to view the version for your file you can right click it and select the view tab)

##### Share on other sites
Quote:
 Original post by kirkdSure, not that it'll help much, but...Dim Enteris as LongEnteris = imgList.ListImages.CountimgList 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
Doesn't this suggest that the problem is with that PC?! At my work one of the testers found weird access violations that noone had ever seen before when not even doing anything, then my recordset which I never modify supposedly had missing fields, then I found that the FileExists function was lying to me, then I found that the OS failed to warn when files were being overwritten. I discovered that this XP machine has regular problems with the B.S.O.D! Needless to say I flicked the bug reports back where they came from, saying politely that the PC was f*%#&d! Works fine on every other PC.
They're not going to fix this PC until janurary, and the tester is supposed to test my product with that hunk of junk! Sorry for the rant, but you get my point.

btw, write a test program that executes the same failing line of code with minimal other code surrounding it.

##### Share on other sites
woh woh woh...

If your program is working on 5 machines but not a 6th say - then it's the 6th machine that has an installation problem.

It's most likely a service pack issue. Do Windows Update, ensure newest version of IE, and reinstall the VB runtime.

If necessary create an install program that includes the exact dlls you are using distributed in the local directory. Dlls search order starts with the current directory... anything in the current directory usually overrides dlls found anywhere else.

##### Share on other sites
Hey, hey, hey! Who is this Kryptus character and how did he/she hijack my question? That was quite rude. Moderator?

To answer some questions directed at the person who originally posted the question, aka ME, with answers from ME:

The ImageList control is on a form in my project. The images it contains are loaded at design time through the properties box rather than loading them at run time.

I'm developing with Visual Basic 6 SP6 and have the full Visual Studio 6 SP6 package installed.

The version of MSCOMCTL.ocx is the same on the "broken" machine as it is on the working machines. I don't have access to that machine right now - it is a laptop that someone is now using.

I agree that is must be something about that particular machine or the OS on that machine. I've found many web pages (forums, MSDN) that describe my exact problem but on Windows XP. The machine in question has Win2000 with SP4 and I assume it is up to date. I'm currently installing all possible updates on one of the working machines to see if that breaks the application.

Thank you all for your input!!

-Kirk

##### Share on other sites

This topic is 4762 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628732
• Total Posts
2984437

• 25
• 11
• 10
• 16
• 14