is there a way to modify code in vb.net on the fly when it is running I vb 6 you could hit ctrl break then modify the code then hit F5 and the changes were made. in VB 7 u have to do a recompile after u make the changes for them to take affect. Does anyone know if there is a way to make changes and not recompile the code and have the changes take affect right away.

is there a way to modify code in vb.net on the fly when it is running?
MarilynJ
The previous posts stated that a breakpoint should first be made. But what about the times when you want to see the code that prompted the messagebox for example In VB6, when you get a message box, you can press CTRL Break then you can see the code. You don't need to know in advance what exact part of the code you are "debugging"
P Cause
Hi,
I am referring to VB.Net.
There are two simple ways to set breakpoints in your coding. Remember this will only break during a debug run of the coding.
1) The easy way, as far as giving directions, is to place the cursor in the line of coding in which you want the program to break and press "F9".
2) The other way is to click the "grey" area to the left of the line of coding you want to set the breakpoint at.
You can tell that a breakpoint is set by seeing a red dot to the left of the coding and the coding will be highlighted in red. (Assuming you have left VB in default configuration).
Press "F5" to run the coding in debug mode.
Thank you,
James
BIG S
Hi,
If you use breakpoints you can actually make changes to the coding when the application breaks for the breakpoint. When you hit the "Continue" button (pressing "F5" does the same thing) the changes will take immediate effect. The "CTRL" + "Break" combination also works.
This will only work in debugging mode (Pressing "F5" or the "Play Button"); this will not work on releases, builds, publishes, or if "Start Without Debug" (Pressing "CTRL" + "F5" combination).
Thank you,
James
Nagaraja Subbrayalu
Do u mean in VB 6 or VB 7 cause i can not get it to work in VB 7 or vb.net then
Christiana
I have the same problem as well. I have two computers and on one I can edit and change code in break mode but the other does not allow it.
Also debug.print does not work.
I had a look at the above suggestions but none of them helped. Any Ideas
Thanks
Phillip S.
In vb7 (.net 2003) Edit and Continue does not work, however in .net 2005 it supose to work
Remco
rxg
Yeah, Sorry that does not work for me and i dont think its only my copy of visual studio. Try to add this code
MsgBox 2 + 2
then add a break point on the code and then hit f5, change one of the numbers and u still see that after u hit f5 it say displays 4
Guy Baron
cmwith
In VB7 (2003) Edit and Continue was not present - so you could not change.
In 2005 Edit and Continue works When you are building / debugging 32 bit applications. But if your trying to debug a 64 bit application, then edit and continue is not supported.
As you stated earlier you are using VB7 (2003) then the answer is that you cannot break, change values and continue as you did in VB6. Your options are to upgrade to 2005, which may be through purchasing VB 2005 or you could simply download and use the free VB Express edition and see if this works for you.
Josh Smith
Folks,
Go to :-
Tools | Options || Debugging | Edit and Continue |
then make sure that "Allow me to edit VB files while debugging" is checked.
cheers
Martin
Richard Meyers
Hi,
That is odd; I can make changes at the breakpoint set for:
MsgBox(2+2)
When the application breaks and during the break I change one of the "2"s to a different number and press "F5" to continue, the messagebox will show the correct result using the new number. I did notice that your syntax for the messagebox isn't correct; however, I doubt this would cause your problem. Try it with the syntax I wrote, maybe for some unexplainable reason this is causing it, always worth a shot regardless of slim chances to fix problem.
Can you make changes to the coding during the break Not asking if the coding takes effect; just asking if you type in a new number for one of the "2"s, does the coding show the new number If it doesn't show the new number in the coding then either the 'Break all processes when one process breaks' or the 'Enable Edit and Continue' are disabled. I ask this because I can't seem to replicate a situation where if I change the coding during the break, and it shows the change in my coding window, it doesn't take immediate effect in the results displayed on the textbox when I press "Continue" (or "F5"). I can make it so that when I try to change one of the "2"s nothing happens; appears as though the coding window is locked. Below you will find some troubleshooting ideas I have.
The only other idea that comes to mind is that maybe you don't have some option turned on to allow edit and continue. I would start with checking the obvious options. While in the VB development environment go to "Tools" and select "Options". Choose "Debugging" on the left pane of the dialog box that appears. Then check the following sub-tree branch sections:
"General" sub-tree branch; Make sure the "Break all processes when one process breaks" is checked.
"Edit and Continue" sub-tree branch; "Enable Edit and Continue" checkbox should be checked. In the lower section ("Native-only Options") everything is checked except "Ask First".
"Just-In-Time" sub-tree branch; all three checkboxes are checked.
I hope this fixes the problem you have.
Thank you,
James