Results 1 to 18 of 18

Thread: [RESOLVED] Problem..

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    115

    [RESOLVED] Problem..

    I have a problem with my program. Once the user clicks a image it changes. I have a restart button and once the user clicks it in loads the original images. But once they start the game again and they click the image it doesn't change.

    How can i fix this?
    Last edited by xNightfox; May 28th, 2007 at 05:27 PM.

  2. #2
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Problem..

    You could start by throwing us a bone...we're not clairvoyants, we need source code :-P
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    115

    Re: Problem..

    Once the user clicks the image:

    image1.picture = loadpicture("c:\changeImage.jpg")

    I have a restart button and once the user clicks it, it loads the original images:

    image1.picture = loadpicture("c:\original.jpg")

    So once they click the restart button it seems that the original picture load coding stays permanent through the program.

    That help?

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    115

    Re: Problem..

    Does

    image1.picture = loadpicture("c:\original.jpg")

    maybe keep loading the image over and over again so it doesn't let the other coding execute? Is there another way of loading a picture just once then stop?

  5. #5
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Problem..

    Can you post the actual code so we can pinpoint the errors.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    115

    Re: Problem..

    'command button for restart
    Private Sub command1_Click()

    form1.Hide
    form2.Show
    image1.Picture = LoadPicture("/original.jpg")

    End Sub

    'changes image
    Private Sub image1_Click()

    image1.Picture = LoadPicture("/change.jpg")

    End Sub

  7. #7
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Problem..

    image1.Picture = LoadPicture("/original.jpg")

    Where is the path?

    image1.Picture = LoadPicture(App.Path & "\original.jpg")

    User App.Path or specify the drive path.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    115

    Re: Problem..

    Still nothing...

  9. #9
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Problem..

    There is no error right? so it means there's no problem with the path. That's odd.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    115

    Re: Problem..

    Quote Originally Posted by xNightfox
    Does

    image1.picture = loadpicture("c:\original.jpg")

    maybe keep loading the image over and over again so it doesn't let the other coding execute? Is there another way of loading a picture just once then stop?
    Is this a possibility?

  11. #11
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Problem..

    Do you have a timer in your code? Is that the only code in your project? There is a problem in your code so post the whole thing.

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    115

    Re: Problem..

    -resolved-
    Last edited by xNightfox; May 28th, 2007 at 05:27 PM.

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    115

    Re: Problem..

    The problem occurs when user clicks the restart command. Before that if you click the image it changes then once you click the restart command and pick a option it doesn't work anymore.

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    115

    Re: Problem..

    Is there a way to reset the image to its original image?

  15. #15
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Problem..

    I'm way tired and it's 3 AM in the morning here can you just upload the project ... YAWN... zzzzz

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    115

    Re: Problem..

    Quote Originally Posted by zynder
    I'm way tired and it's 3 AM in the morning here can you just upload the project ... YAWN... zzzzz
    Take a break and look at this coding tomorrow then

  17. #17
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Problem..

    The prog's coded slightly different to how I would do it, personally...it may be your unique style of coding that is doing it :-P

    where you have the 3 LoadPicture, why do you need to redim and reset them *every* time? Wouldn't it be better doing those once in form_load (after setting cards() as a public variable, of course)

    Why are you even *DOING* the dimming and setting of 3 there? why not generate a random number and LoadPicture based on which number is chosen...it'd be less code too :-)

    ANYWAY, I have your problem solved I think...you set imgCard1.enabled = false at one point and I don't see any attempt to re-enable it again...you can't get click events from disabled images :-P

    And *this* is why you give as much code as you feel comfortable posting...your problem could be *anywhere* in your code and nothing to do with where you think it is :-)
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  18. #18

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    115

    Re: Problem..

    Thanks smUX, I have worked it with your helpful tips and now it's as I want it.

    Thanks to others too.

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