User1146984159 posted
This is something that I'm not sure if it's a problem or something I have configured wrong. Just thinking on it is making my head hurt!!
So here goes. What I'm doing...
1. create a blank VS2010 web project called "MySite" targeted at 4.0
2. create a new class object, calling it "class1.vb" (cause it's so unique!!)
3. change default code to read as such...
Namespace MySite
Public Class Functions
Public Shared Function WhatIsTodaysDate() As String
Return Date.Now.ToLongDateString
End Function
End Class
End Namespace
4. create a new webform and drop a label control on it.
In the page_load event, I want to set the label to equal the value of Function WhatIsTodaysDate. Simple enough, but now comes the part that escapse me.
I can do this...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Label1.Text = MySite.Functions.WhatIsTodaysDate()
End Sub
but if I want to shorten my code, and call the function using an "Imports" tag i have to do this...
Imports MySite.MySite.Functions
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Label1.Text = WhatIsTodaysDate()
End Sub
End Class
Why is VS asking me to call the namespace twice if I use the "Imports" directive????
I'm sure this has got something to do with VS2010 and the 4.0 framework.