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

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

Related

Form designer missing controls after installing VS 2017 update

Today, VS 2017 Community Edition recommended I take a small update, which I did.
Now any VB.NET solution that I open shows a blank form (as if adding a new form). However, in examining the files, all of the controls and the associated code are present in the files. It just appears that the VB.NET Form Designer is not happy with something in a file.
Is there anything I can do to kick the Form Designer to display the form correctly or is there anything I can examine to ascertain some specific error it might be throwing so that I can look in the right place for resolution.
I figured it out and thought the solution might be useful for others. For some reason, the new version was converting every VB Form control from this (for example) Me.labelFrequency.Location = New System.Drawing.Point(113, 197) to this Me.labelFrequency.Location = New System.Drawing.Point(-32768, 197)(Note the italicized invalid coordinate). It did this for EVERY control in the project. The negative coordinate was throwing off the Designer (obviously). I cleared the VSTS cache and restored a version of the xyzzy.Designer.VB file with the correct values and it stopped doing this. Left this here in case anyone else found this useful.

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.

How do I get Visual Studio 2012 to generate code from a windows form design?

I am trying to add a simple windows form to my VB.Net project. I have used the designer to design the form how I want it with buttons, a text box and a Timer. The problem is when I try to view the code, there is only an empty class that looks like this:
Public Class MCastMain
End Class
I have set the application type to a windows form application in the project properties, and I have made a successful build of the application since doing so. I have been scrawling the internet and this forum for about half an hour now and I can't find one other person who is having this problem, nor can I find a tutorial that mentions any special steps that must be taken beyond what I have done. This is the first project I have done in Visual Studio.
I know this is probably stupid simple, but I have no idea what to do. Any help is appreciated as always.
Forms comes as partial class meaning the code is separated in two files.
The "empty" code you shown is from "mcastmain.vb" (if the file is named as the class).
With that one there is a (probably hidden) file "mcastmain.designer.vb" file which contains the generated code by the designer ; and is not meant to be modified (as any designer change will rewrite the file).
To show the hidden files you have to look in the solution explorer on the button on it's top there should be a "show all files" button. (it may be possible to do the same via the menu but I don't have VS right there to be sure where)

VB control styles change for unknown reason and cannot change back

For some reason while I program in Microsoft Visual Basic 2010 Express OR VS Express for Desktop my controls seem to change style for an unknown reason.
This screenshot is in the DESIGN part of my programming:
And here is when I actually run the program:
I don't understand how it can change like that, I've tried changed properties on all the controls, but they just keep changing to whatever style that is...
I can update with more screenshots if need be.
Thanks
Answer given via a comment:
Using Application.EnableVisualStyles() Fixes the whole thing.
Thanks to #Plutonix for the answer!

What happened to Intellisense for enum types in Visual Studio 2010 using 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.