C
C#3y 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
tacosontitan
tacosontitan3y ago
@skillyn which foreach?
skillyn
skillynOP3y ago
foreach (var item in listBox1.Items) in button clic k button 3 clikc click* i can stream if u want to
tacosontitan
tacosontitan3y ago
What is result because I don't see that
skillyn
skillynOP3y ago
resulttat in BASAT database Resulttat this
tacosontitan
tacosontitan3y ago
Okay, so your score is not making it to your data storage?
skillyn
skillynOP3y ago
yes, but if i run code with breakpoint it goes well without breakpoint it is always equal 0 with breakpoint it has value
tacosontitan
tacosontitan3y ago
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
skillynOP3y 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 ?
tacosontitan
tacosontitan3y ago
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
Accord3y 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.

Did you find this page helpful?