Posts I'm probably going to make someone mad, but...
Post
Cancel

I'm probably going to make someone mad, but...

... this has got to be one of the dumbest features in VB.NET.  It's bit me a few times when I've had to help someone on their machine and I go looking using intellisense for something and it's not there.  My brain is telling me that there's something there that I can use, but can't remember the name of it.  So what was it called... ummm... look through the list and can't find anything that is ringing a bell.  Low and behold, the default is to hide “advanced members”.  What exactly is “advanced”?  Who decides this?  Also, I thought that intellisense was supposed to be “everything” accessible in a given context.  Why hide anything?

As a simple example, why is it that CanFocus is hidden?  Don't you think that it would be nice to see if a control can accept being focused prior to just blasting a Focus() method and checking to see if it was successful after the fact.  On top of this, even the sample in the online help shows the usage of CanFocus:

<FONT color=#0000ff>Public Sub</FONT> ControlSetFocus(control <FONT color=#0000ff>As</FONT> Control)
   <FONT color=#008000>' Set focus to the control, if it can receive focus.
</FONT>   <FONT color=#0000ff>If</FONT> control.CanFocus <FONT color=#0000ff>Then</FONT>
      control.Focus()
   <FONT color=#0000ff>End If
End Sub</FONT>

Based on the property being hidden in intellisense, you'd think you would write the code as:

<FONT color=#0000ff>Public Sub</FONT> ControlSetFocus(control <FONT color=#0000ff>As</FONT> Control)
   <FONT color=#008000>' Set focus to the control, if it can receive focus.</FONT>
   <FONT color=#0000ff>Dim</FONT> success <FONT color=#0000ff>As Boolean</FONT> = control.Focus()
   <FONT color=#0000ff>If Not</FONT> success <FONT color=#0000ff>Then</FONT>
      <FONT color=#008000>' Handle accordingly.</FONT>
  <FONT color=#0000ff> End If
End Sub</FONT>

Now from a C# vs VB.NET perspective... no wonder there's a stigma surrounding VB being for a “lesser” crowd.

This has got to be one of the dumbest “features” in VB.NET today... not to mention... extremely buried.  Yeah... the first place I would go look is in Tools | Options | Text Editor | Basic | General.  Not to mention, this is just downright insulting... there is NO productivity gain of ANY KIND by hiding these so-called “advanced members“!  So what exactly was the point of hiding them?

This post is licensed under CC BY 4.0 by the author.