Results 1 to 8 of 8

Thread: Program Crash

  1. #1

    Thread Starter
    Addicted Member overhill's Avatar
    Join Date
    Mar 2000
    Location
    KS, United States
    Posts
    181
    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]

  2. #2
    Hyperactive Member MPrestonf12's Avatar
    Join Date
    Jun 1999
    Location
    NY
    Posts
    330
    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

  3. #3

    Thread Starter
    Addicted Member overhill's Avatar
    Join Date
    Mar 2000
    Location
    KS, United States
    Posts
    181
    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.

  4. #4
    Hyperactive Member MPrestonf12's Avatar
    Join Date
    Jun 1999
    Location
    NY
    Posts
    330
    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

  5. #5

    Thread Starter
    Addicted Member overhill's Avatar
    Join Date
    Mar 2000
    Location
    KS, United States
    Posts
    181
    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!

  6. #6
    Hyperactive Member MPrestonf12's Avatar
    Join Date
    Jun 1999
    Location
    NY
    Posts
    330
    Where in your code did you place the set image = nothing?
    Matt

  7. #7
    Hyperactive Member MPrestonf12's Avatar
    Join Date
    Jun 1999
    Location
    NY
    Posts
    330
    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

  8. #8

    Thread Starter
    Addicted Member overhill's Avatar
    Join Date
    Mar 2000
    Location
    KS, United States
    Posts
    181
    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
  •  



Click Here to Expand Forum to Full Width