|
-
May 28th, 2007, 08:33 AM
#1
Thread Starter
Lively Member
[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.
-
May 28th, 2007, 08:38 AM
#2
PowerPoster
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.
-
May 28th, 2007, 08:44 AM
#3
Thread Starter
Lively Member
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?
-
May 28th, 2007, 08:58 AM
#4
Thread Starter
Lively Member
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?
-
May 28th, 2007, 09:01 AM
#5
Re: Problem..
Can you post the actual code so we can pinpoint the errors.
-
May 28th, 2007, 09:08 AM
#6
Thread Starter
Lively Member
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
-
May 28th, 2007, 09:14 AM
#7
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.
-
May 28th, 2007, 09:16 AM
#8
Thread Starter
Lively Member
-
May 28th, 2007, 09:22 AM
#9
Re: Problem..
There is no error right? so it means there's no problem with the path. That's odd.
-
May 28th, 2007, 09:23 AM
#10
Thread Starter
Lively Member
Re: Problem..
 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?
-
May 28th, 2007, 09:31 AM
#11
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.
-
May 28th, 2007, 10:32 AM
#12
Thread Starter
Lively Member
Last edited by xNightfox; May 28th, 2007 at 05:27 PM.
-
May 28th, 2007, 10:47 AM
#13
Thread Starter
Lively Member
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.
-
May 28th, 2007, 12:58 PM
#14
Thread Starter
Lively Member
Re: Problem..
Is there a way to reset the image to its original image?
-
May 28th, 2007, 01:53 PM
#15
Re: Problem..
I'm way tired and it's 3 AM in the morning here can you just upload the project ... YAWN... zzzzz
-
May 28th, 2007, 02:04 PM
#16
Thread Starter
Lively Member
Re: Problem..
 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
-
May 28th, 2007, 04:31 PM
#17
PowerPoster
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.
-
May 28th, 2007, 05:27 PM
#18
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|