Events tab randomly appears and disappears in VS 2

2020-03-17 04:38发布

问题:

I know it's a minor annoyance.. but it's still an annoyance and it baffles me.. About 3 months ago I was using VS 2008 and when I went to the "Properties" tab there was the little lightning bolt for events(in design mode). Then it suddenly went away.. about a week later I discovered that if I didn't have the properties tab "stickied", then the events thing would be there, but not when its stickied.

This morning all of this was working fine. Now today I went to add an event, and suddenly the little lightning bolt icon is no longer there. I can not see any option disabling and it disappeared without me doing any reconfiguration.. Even without restarting VS. And I have tried restarting VS to no avail..

What am I missing here? Is this a highly annoying bug in VS 2008(its up to date) or am I missing some configuration?

Update I'm attaching a bounty to this question to see if I can get something a bit more helpful. In short it seems like the event tab will appear and disappear on a month or two cycle. And it's not a context problem. I have my cursor inside of a button for instance and I can edit all the properties of the button yet the events tab does not show up... More confusing is that yet again, this was working a few weeks ago

alt text http://img714.imageshack.us/img714/6301/eventsx.png

回答1:

The Events tab is driven by the designer. If the designer is active, or the source view is active but the designer is synced, you should see the Events tab. Once you change the source view content, the designer will be out of sync and won't show the Events tab anymore. You can get the Events tab to show up again by switching to the designer and back.

You can tell whether the designer is synced by looking at the type information in the Property Grid. If it is synced, you'll see the full .NET class name (e.g. for a Button, you'll see something like Button1 System.Web.UI.WebControls.Button), and if it's not synced, you'll just see an XML element (e.g. Button1 <BUTTON>). Also, the list of properties available for the element and how they are arranged in the Property Grid will change according to whether it's using the type properties, or the schema properties.



回答2:

There is a known bug in Visual Studio 2008 where it will not display the events button for ASP.Net controls within an asp:Table control. The workaround from Microsoft:

Use regular <table> and <tr> and <td> tags and mark them as runat="server". This will give you the ability to modify them in code and the designer will give you acccess to the properties and events on the button.


If this is not the case for you, try these troubleshooting steps:

  1. Try deleting the .user and .suo files (located in the same folder as your solution).

  2. If that does not help: Does this occur in other projects/solutions, or just the one? Does it occur when loading the same project/solution on a different computer with a similar setup?

    If it always happens on your computer but not others, it may be that some important file is corrupt - try reinstalling VS (and perhaps, unfortunately, even Windows).

    If it happens in the same solution on other computers, but not in different solutions, the solution/project/designer files may be corrupt. Narrow it down to one of those, and recreate the offender (it may also be a bug similar to the one above, in which case all you can do is submit a bug report and wait...)

    If neither or both... well, something super-screwy is going on!



回答3:

Where is your Properties Button? That's missing too on yours. They might be related. And why do you have <BUTTON>? Mine doesn't look quite like yours.

Here what my Properties pane looks like (VS 2008):

alt text http://img62.imageshack.us/img62/2365/whereisyourpropertiesbu.png

Edit:

Did you try Reset Menu Layout from the File->Window menu:

alt text http://img25.imageshack.us/img25/7241/resetwindowlayout.png

In Class Diagram mode on my computer I don't get the Properties Button or the Events Button:

alt text http://img811.imageshack.us/img811/1455/classdiagrammode.png

I only seem to get the Properties Button and the Events Button from within Design Mode:

alt text http://img294.imageshack.us/img294/8011/designmode.png

There's also this right-click menu:

alt text http://img17.imageshack.us/img17/3867/rightclickmenu.png



回答4:

This might sound crazy but if you are using a Microsoft wireless mouse. Try unplugging the dongle... Does it re-appear? You can now plug it back in and it will be fine until you restart VS.

I had that very problem. Had my properties window disappearing too.

Was driving me crazy and took me months to work out. As for a fix, I didn't find a permanent one. But there were rumours it was specific to Microsoft mice (and keyboards? too maybe)



回答5:

I think that lightning bolt icon is contextual- if you don't have something with events selected, you won't see it.



回答6:

I don't know why this problem occurs, but the solution is just 2 clicks away.

The reason for not seeing the event tab is because there 2 multiple entries in the dropdownlist (marked with a questionmark in your picture). The one will be from the type ASP:net button and the other is , as seen on the picture, just button.

The solution is to pick the other btnLocate button from the drop down list. There you have full access to the events.