|
-
Aug 8th, 2000, 06:07 PM
#1
Thread Starter
Addicted Member
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]
-
Aug 8th, 2000, 07:55 PM
#2
Hyperactive Member
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
Matt 
-
Aug 9th, 2000, 11:16 AM
#3
Thread Starter
Addicted Member
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.
-
Aug 10th, 2000, 11:25 AM
#4
Hyperactive Member
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!
Matt 
-
Aug 11th, 2000, 12:57 PM
#5
Thread Starter
Addicted Member
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!
-
Aug 11th, 2000, 05:13 PM
#6
Hyperactive Member
Where in your code did you place the set image = nothing?
Matt 
-
Aug 11th, 2000, 05:22 PM
#7
Hyperactive Member
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
Matt 
-
Aug 11th, 2000, 07:08 PM
#8
Thread Starter
Addicted Member
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|