Timeline for Minesweeper game using Winforms
Current License: CC BY-SA 4.0
20 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 13, 2019 at 10:47 | vote | accept | Stijn Hendriks | ||
Mar 13, 2019 at 10:36 | comment | added | Tyler Gregorcyk | @StijnHendriks Your welcome and sense your new here im going to mention that if you think a answer is useful you should vote it up with the up error and then you can also hit ✅ for the best answer for this question which will put the answer at the top to make it easier for others who might have a similar question find the best answer. | |
Mar 13, 2019 at 10:30 | comment | added | Stijn Hendriks | After changing it in the designer it seems to work. So I just wanna say thank you very much for not only helping me with my problems but also for explaining what was wrong and why you changed certain things the way you did. For this school project this program is perfect, because it doesn't use code we haven't covered during class. So thanks for making my code better by using things that are not top-level difficulty. | |
Mar 13, 2019 at 10:08 | comment | added | Tyler Gregorcyk | @StijnHendriks Ya how i did it was I went to the Designer class and just changed how they were added to be in order. [Here is the past bin of the groupBox1] (pastebin.com/sB9Xu7Ji). If you have changed the form design sense you uploaded the design here I would recommend doing the change by hand and not copy-pasting. The only part that needs to be change from your original is the order the buttons were added. | |
Mar 13, 2019 at 10:03 | comment | added | Stijn Hendriks | I think it is now my fault that is doesn't work, because I am not sure how to make it so the buttons in groupbox1 are in the right order. Do you have any idea how to do that? Right now I just put the buttons in the groupbox in the design.cs. Is there a better way to do this? | |
Mar 13, 2019 at 9:38 | history | edited | Tyler Gregorcyk | CC BY-SA 4.0 |
added 93 characters in body
|
Mar 13, 2019 at 9:32 | comment | added | Tyler Gregorcyk |
@StijnHendriks Ah I see my problem. I was dumbly checking if listLength is grater then 0 and not the number we generated. I downloaded your code and made the change and it worked perfectly without issue. I have update my answer to show this. Sorry about that dumb mistake
|
|
Mar 12, 2019 at 21:32 | comment | added | Stijn Hendriks | I have tried every solution I could think of and i got it to work to the point where it doesn't crash but I still won't show any orange colors. Green and red work fine, it's just the orange that doesn't work | |
Mar 12, 2019 at 18:26 | history | edited | Tyler Gregorcyk | CC BY-SA 4.0 |
Fixed check for lsit lookup
|
Mar 12, 2019 at 17:26 | comment | added | Tyler Gregorcyk | @stijn Ah looks like you are subtracting from random which can make it a negative. Add another check on those if statements that the value is a non-negative. As for nothing being orange, Are you getting red buttons? Looks like groupBox1 in you Designer class isnt adding the buttons from first-last 1-25 order. It is just adding them at random. I noted in my answer that they need to be in order. Do some simple troubleshooting, Its one of the best ways to understand how you CPU runs code and how the compiler works, which will give you a better understanding of how to write faster and better code. | |
Mar 12, 2019 at 17:17 | comment | added | Stijn Hendriks | I run the new code and then press the play button in the program I still get the error: "System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index'" This error is located at the line: if (listLength <= plusOrange2) listButtons[plusOrange2].ForeColor = Color.Orange; If I run it a few times it does run sometimes when I press the play button, but then no button is orange. | |
Mar 12, 2019 at 16:46 | comment | added | Tyler Gregorcyk | @StijnHendriks Yes I also forgot to add back the creation of the random. I have added it the script. You should be able to figure out any other issues. Luckily C# has a rely good error system and the errors are pretty strait forward. Also if you are using VS or Rider or another modern IDE it will show you what line it failed at and then what the error is. Let me know if you need any help and what other errors you found and how to fix them. I wont be able to respond till the morning though if you need help because im heading off to bed. I hope you do well on your project! | |
Mar 12, 2019 at 16:43 | history | edited | Tyler Gregorcyk | CC BY-SA 4.0 |
added 36 characters in body
|
Mar 12, 2019 at 16:40 | comment | added | Stijn Hendriks | I changed the code to the new code and I still get the same error. I was also wondering where you have the following line: "Random rnd = new Random();" Are you sure this code works or am I doing something wrong? | |
Mar 12, 2019 at 16:20 | comment | added | Tyler Gregorcyk | @StijnHendriks Ah yes I forgot to check if the button was in the list. I have corrected the code | |
Mar 12, 2019 at 16:20 | history | edited | Tyler Gregorcyk | CC BY-SA 4.0 |
Corrected for list out of bounds error
|
Mar 12, 2019 at 16:12 | comment | added | Stijn Hendriks | I implemented your code into the program and it gave me a new sort error. It gave me this: "System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index'" And the few times that it did work, it doesn't put the orange color in the right place for some reason. | |
Mar 12, 2019 at 16:02 | history | edited | Tyler Gregorcyk | CC BY-SA 4.0 |
added 2 characters in body
|
Mar 12, 2019 at 16:02 | comment | added | Tyler Gregorcyk | @Stijn Hendriks Just wanted to say thanks for adding the designer code to your question. I wanted to ask you to but unfortunately, you cannot comment on other people questions when you have less then 50 rep. My answer was made without seeing it but it should all work. I dont have time now (IT took me like 35 minutes to type the answer out) to change anything from it. I hope it helps you! | |
Mar 12, 2019 at 15:57 | history | answered | Tyler Gregorcyk | CC BY-SA 4.0 |