-
Jul 27th, 2021, 10:30 AM
#1
Thread Starter
Lively Member
-
Jul 27th, 2021, 10:48 AM
#2
Re: Break not working
You are not giving many details here.
The messagebox will not show the second time if the private sub won't hit or if Player1_Card_nbr <> 5
Is the private sub breaks?
If not you are probably not calling it on the second time.
Also check that you are on debug mode and not release when you run your app.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Jul 27th, 2021, 10:55 AM
#3
Re: Break not working
Try putting a breakpoint somewhere else.
Back in VB6, it was possible to skip over breakpoints under certain circumstances, but that changed. I have never seen a breakpoint be missed in .NET...with one exception, and you'd need to be able to see the code to check on that.
This is not the answer:
If the code in question is in a dll, then there are circumstances where the breakpoint looks fine when the code isn't running, but when you start the code running, the red ball on the left will become just a red circle with a white (or maybe it's yellow) center. In that case, the breakpoint won't be hit.
That seems unlikely to be the case here, though, and in those cases, the breakpoint will NEVER be hit, which does not match what you described, because you said it did get there the first time, but not after that. In what I described, the breakpoint wouldn't be hit the first time, or any other time.
This is back on topic:
The other possibility, and the one that is virtually certain to be the case, is that the breakpoint isn't being hit because the code that has the breakpoint on it is never executed. You THINK it should be, but it isn't. You even said that the messagebox is only showing up the first time. So, if the messagebox isn't showing up, then the code isn't being executed, so it's no surprise that the breakpoint isn't being hit, since the code it is on is not being executed. You can kind of confirm that by putting a breakpoint somewhere that will be encountered over and over, just to see that it is happening.
So, why is that code not being executed? I notice that it looks like an event handler without a Handles clause. That suggests that you are hooking up that method to some event using AddHandler. My first guess is that you are encountering a RemoveHandler that you didn't think you were encountering, so the event handler is removed after that first time through. There are other possibilities, but it is something like that. It's not a case of the breakpoints not working. They are working fine, it's just that they are on code that, for some reason, is never reached after that first time through.
My usual boring signature: Nothing
-
Jul 27th, 2021, 11:22 AM
#4
Re: Break not working
This appears to be a case of a missing handles clause:
Code:
Private Sub PLAYER1_OFF(sender As Object, e As EventArgs)
The above line looks as if it is an event handler for a control. If you're not using AddHandler to manage the event handlers then you'll need to add the handles clause to your sub:
Code:
Private Sub PLAYER1_OFF(sender As Object, e As EventArgs) Handles SomeControl.SomeEvent
-
Jul 27th, 2021, 11:31 AM
#5
Re: Break not working
you could also put a "stop" command (just write "stop" where you want), that will act as a break. after that you can go line by line with F8 (VS2010) or F11 (VS2017) or an other depending of the version of VS
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Jul 27th, 2021, 03:13 PM
#6
Re: Break not working
Yeah, stop would work...but only if execution gets to that line. If execution was getting to the block with the breakpoint, then the messagebox would have popped up. Since that didn't happen, execution is getting nowhere near that.
My usual boring signature: Nothing
-
Jul 27th, 2021, 04:27 PM
#7
Re: Break not working
I see no use for the second break. The first at the start of the sub should be enough then going step by step should gives what's happen. By the way, if the sub is not called the break will do nothing.
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Jul 28th, 2021, 12:26 PM
#8
Thread Starter
Lively Member
Re: Break not working
Stop worked great - thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|