Michaelj42
asked on
error BC30001: Statement is not valid in a namespace
Gurus,
This is from the codebehind on an aspx page. Environment is Visual Web Developer 2010 Express, IIS 7.
I'm trying to define a function for massaging time. I'm getting:
error BC30001: Statement is not valid in a namespace.
Function dhRoundTime(dtmTime As Date, intInterval As Integer) As Date
Any help on what is wrong here?
Original code is from here:
http://msdn.microsoft.com/en-us/library/aa227556%28v=vs.60%29.aspx
This is from the codebehind on an aspx page. Environment is Visual Web Developer 2010 Express, IIS 7.
I'm trying to define a function for massaging time. I'm getting:
error BC30001: Statement is not valid in a namespace.
Function dhRoundTime(dtmTime As Date, intInterval As Integer) As Date
Any help on what is wrong here?
Original code is from here:
http://msdn.microsoft.com/en-us/library/aa227556%28v=vs.60%29.aspx
Function dhRoundTime(dtmTime As Date, intInterval As Integer) As Date
' Round the time value in varTime to the nearest minute
' interval in intInterval
Dim intTime As Integer
Dim sglTime As Single
Dim intHour As Integer
Dim intMinute As Integer
Dim lngdate As Long
' Get the date portion of the date/time value
lngdate = DateValue(dtmTime)
' Get the time portion as a number like 11.5 for 11:30.
sglTime = TimeValue(dtmTime) * 24
' Get the hour and store it away. Int truncates,
' CInt rounds, so use Int.
intHour = Int(sglTime)
' Get the number of minutes, and then round to the nearest
' occurrence of the interval specified.
intMinute = CInt((sglTime - intHour) * 60)
intMinute = CInt(intMinute / intInterval) * intInterval
' Build back up the original date/time value,
' rounded to the nearest interval.
dhRoundTime = CDate(lngdate + ((intHour + intMinute / 60) / 24))
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER