C
C#2y ago
skillyn

❔ Line of code not working unless stepped through using breakpoint

after foreach result is still 0 but if i do breakpoing there it equal to numbers
10 Replies
Hazel 🌊💃
@skillyn which foreach?
skillyn
skillynOP2y ago
foreach (var item in listBox1.Items) in button clic k button 3 clikc click* i can stream if u want to
Hazel 🌊💃
What is result because I don't see that
skillyn
skillynOP2y ago
resulttat in BASAT database Resulttat this
Hazel 🌊💃
Okay, so your score is not making it to your data storage?
skillyn
skillynOP2y ago
yes, but if i run code with breakpoint it goes well without breakpoint it is always equal 0 with breakpoint it has value
Hazel 🌊💃
Sounds to me like you have a race condition Which makes sense given that you have a timer doing the same work as your button. Disable the timer and see if the button click starts working.
skillyn
skillynOP2y ago
how can i disable timer sorry i am rookie in c# oh nothing i disabled it and it works but i need that timer due to user's time like if time is up than user has to automatically finish test ?
Hazel 🌊💃
Then your timer shouldn't directly handle the completion, you should have a shared method to handle that. Then, when your timer detects that time is up, it disables itself with myTimer.Enabled = false and then calls the method to complete.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server