Groups | Blog | Home
all groups > asp.net > july 2007 >

asp.net : Very basic compilation error


chris NO[at]SPAM ctlsoft.com
7/16/2007 10:25:15 PM
on page load event I have :

Dim strHTML As String = Month(Now())
litMain.Text = strHTML

Compiles fine but when is run :
Compiler Error Message: BC30108: 'Month' is a type and cannot be used
as an expression.

I've tried whacking .toString on end, no difference.

All it's doing is writing the month value into a literal control. I'm
using VS 2005.

What am I doing wrong ???

cheers.
Sergey Poberezovskiy
7/16/2007 11:38:02 PM
change to
litMain.Text = Date.Now.Month
' or if you need month name
litMain.Text = Date.Now.ToString("MMMM")

[quoted text, click to view]
dodgeyb
7/17/2007 1:41:11 AM
Many thanks !
AddThis Social Bookmark Button