How do I stop visual studios from adding functions while creating forms? - visual-studio

I've always been annoyed that visual studio always thinks a double click means create an action function while creating a form. Sometimes I double click on a label to change the text like I do in other programs then I have to delete code and click back to the form editor.
Is there a way to stop this when I'm setting up a form then turn it back on when I am ready to code?
Thank you for the help.

This is probably better off as a comment, but I lack the rep to comment.
You can't stop this behaviour.
The simplest (and as far as I'm aware, only) "solution" (read: workaround) is to just CTRL+Z twice when this happens (doing it once will cause your form designer to show an error, because the event binding will exist in the form, but the associated code won't exist).

Related

Fields in the XAML editor Property window becoming un-responsive

Edit: I see "Silverlight -" is in front of my question, which I realize may have something to do with the alphabetical order of my tabs... really Visual Studio 2013 should be in front, anyone know if that can be changed?
I've been using the newer Visual Studio 2013 for about a week now, and I've found some quirks with it. The one that seems to happen the most is when I'm in the XAML editor working on something, suddenly if I go over to the property window I can't enter anything. I'm not running/debugging. I can type stuff in the regular XAML code editor window.
Even stranger, one of the times, I could get the cursors to appear in the fields. I typed a bunch of junk and just one character from what I types appeared. Another time I couldn't enter values into the properties, but I could double click on an event in the events window and create a new event handler. Just a minute ago I had the opposite, where I couldn't double click in the events window.
I think VS 2013 introduced async handling of more things, could it be related to that? Or perhaps because I'm using Silverlight? Right now my only workaround is to restart VS, does anyone have any knowledge about this? Anyone else experienced this?
I'm going to submit a bug report, but it would be a while before there's a patch, so I'm wondering if maybe someone understand the problem better and has a workaround? Or maybe just confirm that this exists and that I'm not crazy/my computer's haunted.
Edit:
I should mention another weird thing that happened two nights ago. I thought it was some how my doing, but I never figured out how I could have managed it without noticing. I was working on a piece of code, went to run after changing a few lines, and suddenly I had a ton of compiler errors. I go over to a user control I haven't touched in hours and suddenly the main LayoutRoot grid is completely empty. Luckily I'd committed to source control, but still...
I found an easy way to deal with this problem. It happens a lot after debugging so what I did was I created a batch file on my desktop containing this line taskkill /f /im XDesProc.exe and I run it every time the properties start misbehaving. Its the quickest way to reload the designer's functionality. I submitted this bug to microsoft they claim it will be included in the next update.
Me and another guy are developing a silverlight app and having the same exact problem. I accidentally found where the bug lies and how to mess with it to allow you to type "very briefly". Apparently this has something to do with tooltips. If you hover over anything in the property window when this bug is happening and allow a tooltip to popup while your cursor is blinking in a field, for the duration that the tooltip is up you can resume typing normal. As soon as the tooltip times out and disappears you can't type. So the only way you can edit or search properties is while a mouse tooltip is floating active. Very unusual. Can't seem to find any kind of tooltip settings in the program and the situation is very hard to find on google because search results assume your talking about programming tooltips. As far as I know we have had this issue since before release candidate. We are currently on official update 1 with the same problem persisting.

Remove unwanted code in Visual Studio 2010?

When I'm creating a GUI of Windows Forms in Visual Studio, I sometimes happens to double click on a component and get some auto generated code. To remove this unwanted code, I read somewhere, but I can't remember where, to remove this code you shouldn't delete it, it should be done in some other way to prevent future errors. How do I remove this unwanted code in Visual Studio the right way?
Normally, I simply delete the code and nothing bad come out of it. At worse, when you try to build, you'll get an error in the designer.cs saying some code is not found. Simply delete that and everything will work fine.
You can also use Ctrl+Z when you double-click, but it will delete the component you double-clicked on and you'll have to add it again to your form.
AFAIK, the answer is NO. Unless there is some specific add-ins from Microsoft (Which I am not aware off) which enables it.
So, You will have to manually delete the unnecessary code which have been auto generated.
Control-Z - it will remove the event handler registration from the YourForm.designer.cs file and also the method from YourForm.cs file.
A warning box will come up as soon as you press Control-Z, just click yes.
Just remove it from the XAML code. For example, if you double click a button, search for Click="button1_Click" in your XAML and delete it.
If you created a Windows Forms project, go to Solution Explorer and open file file Form.Designer.cs and from function InitializeComponent() delete this line:
this.button1.Click += new System.EventHandler(this.button1_Click);

VS 2010 C# Express - Intellisense not showing all options

I am having a strange problem with IntelliSense in Visual Studio 2010 C# Express Edition: when it pops up to show me the list of suggestions, the list is missing valid options.
For example, say I want to add a "KeyDown" event handler to a control, I start typing "someControl.K<Ctrl+Space>", but the popup doesn't list the KeyDown event; actually, it does not contain anything starting with a K (not KeyPress or KeyUp either).
This is not so bad, since simply typing "KeyDown" by hand won't kill me, but it is highly irritating, especially when I am dealing with objects whose members I am not familiar with.
After all, one of the uses of IntelliSense is giving you a quick overview of what Methods/Properties/Fields/etc. the object has to offer - but if it leaves out some of them semi-randomly, that point is rather moot.
(By semi-randomly I mean that, while there does not seem to be any discernable pattern for which members are left out, at least it is consistent in that it is apparently always the same ones that are missing.)
Does anyone have any idea what might be causing this phenomenon? A corrupt IntelliSense cache? Is there a way to purge that cache and force a rebuild?
You could try to delete the .sdf and .suo files of your solution (after closing it) and then reopen it.
Also make sure that all Statement Completion options are checked and 'Hide advanced members' is unchecked (see picture).

How to turn off creating events when pressing enter in VS Windows Forms designer?

I frequently find myself accidentally clicking enter when I'm laying out a form in Visual Studio. Whatever the focus is on when I accidentally hit enter, an event method is created in the code.
And you can't just delete the method because its defined in the designer file so you have to go in there and remove code from the designer. I don't find the Enter = create event functionality to be useful in the designer. Is there a way to turn that off?
I seriously doubt it, no config for this in Tools + Options. But be sure to use the normal workaround: type Ctrl+Z, it works. And Y to dismiss the "are you really sure" message box.
If you just press Ctrl+Z,Y, any other unsaved changes you've made on the designer window (such as adding or moving controls) will be lost.
If you type Ctrl+Tab (to return to the designer window), and then type Ctrl+Z, only the insert of the empty event handler will be undone - other changes will be preserved.

Why does my VB6 IDE loses its buttons and menu items?

I still have to use the VB6 IDE.
Unfortunately every time I start the IDE one of the buttons of the toolbar disappears. Almost always it's the Run button which goes first. Sometimes also items from the menu bar or the context menus are missing.
I have to reset the toolbars almost every time I start the IDE (Which is quite often during a typical work day). Recently I bought an IDE plugin which modifies the menu bar and requires a restart after every reset of the menu bar. (Otherwise it would crash)
I could live with just the resetting, but the restart is really annoying.
Is there something I can do?
To solve this problem:
Unload all add-ins.
Right-click on a toolbar and select the Customize... menu.
For each toolbar click the Reset... button (6 times in total).
Reload the add-ins.
For me action 3 was enough.
cf. MZTools faq (thanks to Andrea Bonafini), but these steps are originally from MSDN
It sounds like you recently bought a bad add-in. Can you get your money back? Every time I've had problems with disappearing controls in the IDE it has been due to a bad add-in. You can find out which one it is by disabling them, one by one, each time using the IDE for a while, then re-enable it and disable the next one, until the problem stops.
I still use one problematic add-in. It exhibits behavior similar to yours in that it makes the run button disappear. I avoid the problem by only loading the add-in when I need it, use it (it formats code), then I immediately unload it. If you don't use the functionality of the add-in that often, this could be an acceptable workaround.
Yea, i have this same problem with one of the add-in. But if you reset it. Shut the IDE down and open it back up again without doing anything, the IDE shouuld be able to retain the previous clean setup.
It's just guest, but:
Each graphical element on IDE (like button) is kind of resource (i.e. GDI handle).
Maybe your VB app doesn't manage these resources good enough and after sometime VB IDE cannot redraw elements like buttons (run is used often).
Also, maybe some IDE add-in is in conflict with some other add-in/application and breaks something -- I have this problem with Clip-X and MZ-Tools.
I had a similar problem when I was setting up the IDE to use for the first time, though it may not be helpful if you've been using the same IDE for a while. When I first started using the IDE, I would modify the toolbars and then close the IDE. When prompted if I wanted to save the open file I always said No, since the file was just a dummy file I was using to open the IDE with. Turns out the IDE was saving the toolbar preferences with that file, so they never got saved.
Try opening a file, customizing the UI, saving the file, then closing without modifying the code. This was the solution for me.
I've tracked down the problem and as suggested it was an add-in.
The problem went away as soon as I disabled the Visual Basic 6 Resource Editor.
How to restore your VB6 IDE without reinstalling:
Run Regedit
Find the entry for Visual Basic 6.0
Export your settings in case things
go wrong
Delete the 'UI' setting
Run VB and you will have your popup
menus back
The 'Find' button disappeared from my VB6 toolbar forcing me to select the Edit menu to use Find. I had two add-ins enabled: vbCodePrint and ResourceEditor; so I did away with both of them, turned VB6 off and back on, then put both add-ins back in and my button returned.
If you're still using the VB6 IDE, and I do amongst others, then this problem is not likely to have gone away. I use VB6 in Windows 10, and the problem is still there. But it doesn't affect me anymore.
I have had this problem a few years into using VB5 and VB6. Today, if I start VB6 directly, it may work fine the first time, but buttons will go missing the second time -- ALWAYS.
My solution, which I developed from day one:
Do whatever needs to be done to restore all your buttons. Save the Visual Basic 6.0 registry settings to a file, as suggested previously, and only keep the UI entry. Sometimes, you have to exit VB6 for it to post changes to the registry. So if this doesn't work the first time, try exiting before saving the settings.
I use my own program to launch VB6, which automatically copies my VB6 registry backup back into the registry -- by calling "RegEdit.exe /S D:\VB\IDE_Fix.reg" -- before I launch the IDE . This works every single time, and requires no action on my part.
If you read this, that means you are a programmer. You can make this work by yourself.
Mike
Reinstall,clean registry and update with SPacks etc....

Resources