Friday, March 16, 2012

Option strict with basic function

Hi,

With option strict on, I am trying to write a basic function. When I write

sub page_load(sender as object, e as eventargs)
if not ispostback then
startpage()
end if
end sub

function startpage

...

end function

I am getting the following error:

Compilation Error

Description:Anerror occurred during the compilation of a resource required to servicethis request. Please review the following specific error details andmodify your source code appropriately.

Compiler Error Message:BC30210: Option Strict On requires all Function, Property, and Operator declarations to have an 'As' clause.

What am I doing wrong?

You are declaring the function startpage() without a return value. Declare startpage as a sub, not a function....

0 comments:

Post a Comment