What happened to Intellisense for enum types in Visual Studio 2010 using VB.NET? - vb.net

I am using Visual Studio 2010 Prof.
In C# I can create my own Enumerator and use it like this:
MyEnum value =
Now, Intellisense will suggest a value of MyEnum.
In VB, when I write:
Dim value As MyEnum =
I get a huge list of every types. When starting to write my enumerator value (could be a word like "sunny") it filters out some types but I would like to have it like in C#. Anyway I will use the MyEnum type and no "String nor Objecte nor IntPtr...".
Any idea?
Screenshot
Also I made a short video:
Video with sample (new)
Regards

Simple, all you have to do is click the "Common" tab at the bottom of the Intellisense drop-down.
To prove it, here's a screenshot of what I see in VS 2010, immediately after typing =:
But, even if you have the "All" tab selected, the values defined in the enum will still be automatically displayed first, and even appear grouped together. You will indeed see all possible members and types, even those that are completely unrelated, but it's still pretty easy to find the ones you want.
And no, I'm not using any third-party add-ins or extensions to achieve the demonstrated feat. As best I can tell, I also haven't reconfigured any relevant options from the default settings.

This is a documented issue in VS 2010, pre-SP1. See: https://connect.microsoft.com/VisualStudio/feedback/details/551699/intellisense-enum-values. It has been fixed in SP1. If you can't install SP1, the only workaround is to use the mouse or Alt + , to switch from the "All" to the "Common" tab.

Related

Visual Studio Intellisense constantly popping up

Using VB.NET in Visual Studio 2019. Type a single space character anywhere in the codebase and a popup displays a long list of options. You have to constantly click away or press ESC. This quickly gets annoying.
Tools > Options > Text Editor > Basic > General > Auto list members stops these unwelcome popups...but now "member of" functions are not listed at all! For example:
Dim test As String = "fred"
test. ' Nothing is displayed when the dot is typed, but expected `Length`, etc
Is it possible to get Intellisense for "member of" only, but otherwise switched off and no other automatic listing (so nothing would be displayed when you are just typing away).
What a shambles to do so much with a single setting. If someone from Microsoft is reading this, check out how Borland's Delphi 7 handled this...an IDE of speed and beauty.
Very annoying that it distracts you that much. Im sorry to hear that.
Unfortunately, the final answer is that it cannot be solved, because microsoft would never consider an unpopular opinion.
The 'popup' is one of the most important features why people moved away from notepad in the first place. Every IDE will have it, and if they dont, they soon might. it is rarely unwelcomed.
With that in mind, microsoft didnt intend visual studio to be used without it.

Highlight things marked as obsolete

I recently did some refactoring in our code and marked some widely-used functions as obsolete. The problem now is, that I get not visual indicator when I use an obsolete function right away. I have to hover over the function call to get the popup with further information about that function, and even there the "deprecated" warning is not very prominent. As these functions are to widely-used and cause no real treat, setting the isError property is not an option.
I know that somewhere I saw obsolete functions that were highlighted with some kind of underlining, but I can not find an option that does that. Where is that option, or how else can I achieve a more eye-catching indication?
I have created a simple toy VB.Net console application in MSVS, as you can see in the image the items marked obsolete are underlined in green where they are used.
If you are not seeing this then you will need to provide some more details on your solution's settings - what type of project is it, what version of visual studio are you opening it in, is it the same version it was created in, do you have any third party code linter (eg ReSharper) in use... etc
EDIT: As you mention in your comment, the project's properties, including the Code Analysis settings, will affect whether this underlining show's correctly or not; you will need to ensure the correct rule-set is selected there.

VB.NET RowCount not an accessible property of DataGridView? [duplicate]

I am using VB.NET in Visual Studio Community 2017. I noticed that in some cases the list of available properties and methods for an object is incomplete.
One example can be seen here:
As depicted, I want to use the RowCount property of the dgv object, that is of type System.Windows.Forms.DataGridView. You can see, that right above it the property is there and working fine, I can just type it by hand. It just takes a second or two, before the background compiler (for lack of better term) acknowledges it as correct. The behavior messes up the typing flow, since often IntelliSense autocorrects what it perceives as typos.
Note: This is not exclusive to the shown property. I noticed it for other examples, and also in function calls and other random places, but I could not find a clear methodology of what is missing and what isn't.
Looking around I found e.g. this question, however it deals with a completely different problem.
Is this just a bug in Visual Studio (and if so, is it reported somewhere?), can someone confirm this, and does someone know of a fix?
Followed your steps and I got the same result like yours, I already reported this issue to the VS Product Team, please check this: VS 2017--VB: the intellisense for the DataGridView control not works like VS 2015, you can vote it or add a comment, then we need to waiting for the confirmation from the VS Product Team, thank you for your feedback.
Meanwhile, I tried it in C#>Windows Forms application and the intellisense works fine just like the VS 2015.
Albano Gheller posted an answer on the Visual Studio Community page.
To quote him and the required step for a fix:
I've fixed the problem in this way:
1. I've exported my settings from Tool - Import/Export settings
2. I've set the property HideAdvancedMembers = true inside
<ToolsOptionsSubCategory name="Basic" RegisteredName="Basic" PackageName="Text Management Package">
because C# has true and works
3. I've imported this modified settings.
So to summarize:
Find the part: <PropertyValue name="HideAdvancedMembers">false</PropertyValue> in the exported settings document's Basic ToolsOptionsSubCategory.
Change this to <PropertyValue name="HideAdvancedMembers">true</PropertyValue>, save, and then reimport the settings.
I don't know why hiding members leads to showing more members, but whatever ;-)
In supplement to Jens answer/to save anyone else some work:
Take the following XML, which is the minimum set of settings required to flip the problem attribute:
<UserSettings>
<ApplicationIdentity version="15.0"/>
<ToolsOptions>
<ToolsOptionsCategory RegisteredName="TextEditor" name="TextEditor">
<ToolsOptionsSubCategory PackageName="Text Management Package" RegisteredName="Basic" name="Basic">
<PropertyValue name="HideAdvancedMembers">true</PropertyValue>
</ToolsOptionsSubCategory>
</ToolsOptionsCategory>
</ToolsOptions>
</UserSettings>
Save it on the desktop in a file called a.vssettings
Go to Tools.. Import and Export Settings
Choose Import
Choose No, just import
Browse for the file you saved, do Next, Finish
I presume that there's a bug in VS where they got the boolean logic upside down for the intellisense, and advanced members are hidden when this attrib is false and shown when it's true

Is VS2015 intellisense broken with enums?

Just upgraded from VS2013 to VS2015 Enterprise Update 3 and discovered that intellisense seems broken with enums.
With VS2013, typing space after, for instance:
dim myEnum as MyEnumType =
... would immediately give a choice of enum values of the correct type.
This was also true with more complex situations, where, when choosing from a number of overloaded versions of a method, you could down-arrow through the overloads till you got to the right overload, then type space again, and it would give you a choice of the right enum values of the correct type, for the argument you had got to in the list.
Here's what VS2013 did, for instance:
However, this is the VS2015 equivalent, on the exact same line of code, after scrolling through to the correct overload:
As you can see, it gives a completely wrong list of possible options.
There was a similar problem with a previous version of Studio that eventually got fixed after the whole community howled in pain.
It seems to be back with VS2015 - a significant retrograde step. Now you have to know the exact type it's expecting before it will give you options.
A similar issue seems to have been reported a year ago re the Community Edition but it, or a more subtle version of it is clearly also affecting Update 3 of Enterprise.
Is there any way to reproduce the Common/All tabs behaviour of VS2013?
Edit: here are my selected options:
They're the same as I had in VS2013.
What the intellisense shows is the list of member according to the current signature (or what the compiler thinks it could be), not according to the overload tooltip.
For example see this
It shows the same overall behaviour as in your post.
But to obtain it, after having written the comma after "caption" I changed the current overload tooltip manually using up/down arrow on keyboard.
Note, it was not mandatory to change it manually even without that it was proposing me some overload which takes an IWin32Window for first argument even with an already present string as first argument
Then I pressed space and the intellisense showed what is appropriate given the context not the tooltip.
In your post we can see it's not the same overload in both screen.
I can't say for sure it is what happened for you (given I changed the overload tooltip on purpose) but if I had to bet, I would go that way.

Modify VB property template in VS2008

In VS2008 (VB.NET) when you type Public Property X As SomeType
and press enter, VS auto-generates the rest of that property definition for you.
I would like to be able to customize what VS generates.
Any thoughts on how to go about that? VS must have a template for it somewhere, eh?
Thanks.
I think that the Property generation uses an inbuilt macro. I haven't found it in the list of sample macros provided with VS. However, you can edit the DefineAProperty.snippet* file to modify it as per your requirement. Personally, though, I would suggest creating your own snippet rather than modifying the pre-installed ones.
Some links to more information/Snippet Editors:
Creating and using Snippets - MSDN
Code snippet editor for VB 2008
Snippet Designer - CodePlex