Help with creating a simple function (visual basic.net)

R

Raphael Gluck

Hi
I'm really new to programming and i'm reading through a book, teach yourself
asp.net by SAMS.
I'm having some difficulty with one of the vb.net lessons.
What i am supposed to be doing is create simple function to return the
factorial amount of the numbers 1 to 5.
Factorial is where you take a number and multiply it by all the digits that
exist below that number, e.g 3 would be 3 * 2 * 1 which would give you a
total of 6.

I've been really stuck with this for hours on end. It doesnt help that there
are several very annoying mistakes in the book, ( a bad worker blames his
tools)
So i just wanted to post the code here,
Please somone show me where i am wrong.

Function Factorial (n as integer) as integer
Dim i as integer
for i = 1 to 5
i = i * (i-1)
next i
Return Factorial

End function

Sub Page_load (sender as object, e as EventArgs)
response.write(factorial)
end sub



Please help me.

Raphael
 
J

Jonathan West

Hi Raphael,

This group deals with VBA in Word. VB.NET is something quite different. The
most relevnt group for your question is probably
microsoft.public.dotnet.languages.vb.

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top