Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all,

I got stuck in doing my project.

I am writing a Minesweeper program in vb 2010 Express.

In this game, "heart" are given if the user unluckily press the button with a mine. In the challenge level, user will be given 2 heart.
If the user has used up two hearts and he press the button with mine again, he will lose.

However, when I start debugging, I discovered that the heart remain in 1 when I press the mine for the second time. User will get 10 score when he press the one without mines.

I have tried to make a Do-loop-until and if then else statement but it doesn't work, also with the score calculation.

I have set the score as a global variable and I would like to inset it in to my access database.

This is my program which hasn't finish. I will add the timer afterwards.
If you get anything that you do not understand, feel free to rise it in the comment and I will try to answer it in order let you know what I am asking. (as I know my English is poor.)

https://drive.google.com/file/d/0ByMd9-QgWm4LRjd0RkI4T0xINlU/view?usp=sharing[^]
Posted
Comments
Maciej Los 7-Oct-15 2:42am    
Debug the programme to find out why the count of hearts reamain 1. I suspect that you use local variable instead of global.
Patricia Chang 7-Oct-15 3:08am    
Thanks for answering.
I have debug it and it shows no error in running the program. Thus, I think it is a logic error. Yet, I have tried to use different statements, but still, it doesn't work. Thus, I posted here to sake for your advice.
Setting it in local variable is a good idea!:)
Maciej Los 7-Oct-15 3:17am    
You misunderstood me. I didn't say that you have to use local variable. I said that you have to use global variable.
Patricia Chang 7-Oct-15 3:44am    
Sorry...
I have save it in the module and use Public to save its value since I have tried to open a new form and use Global variable but it doesn't work.
Again, sorry for misunderstanding your meaning. :'(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900