-
I have a program that when a user selects a new item in a ComboBox, the program checks to see if a graphic (transparent *.gif) assigned to that particular item exists and displays the image in an Image control if it does.
The problem that I am having is that on some computers, the program freezes when displaying this graphic. It does not happen every time, but only after viewing quite a few graphics. Visual Basic does not give any errors, but rather the screen freezes and the graphic is half displayed in florescent colors. The mouse will not move and the computer must be rebooted. The weird thing is that the problem does not occur when the program is run under Safe mode. I suspect that it is some conflict with a driver. Does anyone have any ideas on how to continue testing this problem to see if there is a way to work around it? or how to get rid of it?
[Edited by overhill on 08-11-2000 at 08:10 PM]
-
I've had similar problems. What I did was flush out any buffers before another image is opened to free up resources. Try setting the buffer to nothing
IE.
Set buffer = nothing
-
MPrestonf12-
I am not familiar with graphics programming and am simply using the LoadPicture function:
Image1.Picture = LoadPicture(“Path”)
As far as I know I am not working with any buffers. Maybe you can clarify what you meant with setting buffer = Nothing. Thanks.
-
Setting it to "nothing" should free up the resources that it was using. So
Set MyObject = Nothing
will free up the resources it was using.
Try
Set image1 = nothing
Ill have to try someother things and ill get back to you. hope it helps!
-
I tryed "Set Image1 = Nothing" and it took about double the time before the computer froze, but it still did. It seems that freeing up resources affects the problem, but it freezes on a PII 450 with 128 MB RAM, but not on a 486 with 16 MB RAM! I am open to any other ideas that anybody has. Thanks!
-
Where in your code did you place the set image = nothing?
-
overhill--
This syntax seems to work on my machine..I just added 'set image.picture = nothing
Image1.Picture = LoadPicture("C:\Visual Basic 5\Graphics\paddle.bmp")
Set Image1.Picture = Nothing
-
Code:
Private Sub Combo1_Click()
Set Image3.Picture = Nothing
If FileExists("Image Path") Then
Image3.Picture = LoadPicture("Image Path")
End If
End Sub
This code clears the image first and then loads a new image if one exists. If I add Set Image3.Picture = Nothing at the end of the routine, the image will not display. I still want the image to display as long as the ComboBox has not been clicked again. Thanks for all your help so far!