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