Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4332482
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:15:46+00:00 2026-05-21T10:15:46+00:00

In VS2010 for a VB.NET 4.0 project, the IDE puts a green line under

  • 0

In VS2010 for a VB.NET 4.0 project, the IDE puts a green line under the last line in the following code:

Dim cityLocal As DateTime
cityLocal = externalFunction()
cityLocal.Today()

The suggested code replace is to update ‘cityLocal’ with ‘Date’. The reason is:
Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.

But it does compile and does work correctly. Is this just a bug in the VS2010?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:15:46+00:00Added an answer on May 21, 2026 at 10:15 am

    Today is a shared member, thus should not (but can) be accessed through an instance of DateTime change your code to.

    DateTime.Today

    Although Visual Studio gives you suggestions to correct the “Error” it is infact a compiler warning, warning you that there is no need for an instance to access the shared member. You’ll find that it is not listed as an error in the error list. Which is why it compiles correctly.

    The Visual Basic language specification states

    9.2.4 Shared Methods

    The Shared modifier indicates a method
    is a shared method. A shared method
    does not operate on a specific
    instance of a type and may be invoked
    directly from a type rather than
    through a particular instance of a
    type. It is valid, however, to use an
    instance to qualify a shared method.

    http://www.microsoft.com/downloads/en/details.aspx?FamilyID=01EEE123-F68C-4227-9274-97A13D7CB433:

    More information on the warning can be found in the documentation.

    http://msdn.microsoft.com/en-us/library/y6t76186.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

IDE: VS2010 Framework.net: 4.0 I created a c# dll project under Visual Studio 2010,
Compiled my .net 2.0 project, under mono 2.4 profile in vs2010. Running executable on
I have a ASP.NET MVC2 project in VS2010 that can be deployed in two
I’ve just enabled config transformations on a .NET 3.5 project in VS2010 RC after
I have this code written in .NET 4.0 using VS2010 Ultimate Beta 2: smtpClient.Send(mailMsg);
If I make a change in my ASP.NET project using VS2008 or VS2010, I
So in a C# .NET v4 project in VS2010, I've got a debugging issue.
I migrated my ASP.NET project from 3.5 to 4.0 (VS2008 to VS2010) and when
I am building my first ASP.Net web application project in VS2010. The site has
I have a Windows Form VS2010 .NET 4 project with a standard DataGridView bound

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.