CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2006
    Posts
    97

    [RESOLVED] Can sum1 take a look

    Hi - I've mad a little program that searches a map and puts the name of area into a listbox (See attachment)

    BTW - At the moment only the northeast works because I haven't programmed the rest

    Anyway the problem is that when I click on the north east another map comes up which is fine BUT...

    When I click on each area its fine but as soon as I click on a area thats already listed in the listbox it freezes and no other areas can be selected. Something similar happens when I press the delete selected command button

    Can someone please look and see what the problem is for me

    Thanks Bubblegum
    Last edited by bubble_girl; August 16th, 2007 at 01:14 PM.

  2. #2
    Join Date
    Nov 2005
    Location
    Omaha, Nebraska, USA
    Posts
    696

    Re: Can sum1 take a look

    Without looking at the code, did you put breakpoints in your code at the first line of the command button's click event and the image's click event?

    If you break into those and step through, you can try to see where it "freezes" and try to figure out why.



    Looking in the code (because I had more time than I thought), I see why it stops adding the places. Your variable CheckLine is used to see if it's already in the list. Now, in your case, it's a public variable, which means it keeps whatever value you set it to even when you go into another function.

    In your case, since you never reset it when clicking on any of the image, it never resets to 0, so even if the area you're clicking on isn't found, CheckLine keeps it's non-zero value and your program believes that the area they clicked on is in the list, even though it's not.


    I didn't look into your Clear Selected event, but just looking at the code, I don't see where it could fail like that.

  3. #3
    Join Date
    Jan 2006
    Posts
    97

    Re: Can sum1 take a look

    Thanks I've managed to do just that and solved the problem
    Last edited by bubble_girl; August 16th, 2007 at 01:13 PM.

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

Featured