Use a function when you want to perform somthing and return a result.
Use a sub when you want to perform somthing but don't want to return a result.
Example, you want to change somthing in the forms apperace:
vb
private sub ChangeSomeStuff(colorParam as integer, heightParam as single)
'The sub is named ChangeSomeStuff, it takes two parameters - data sent to the sub.
'They are colorParam which must be a integer and heightParam that must be a single.
form1.bgcolor = colorParam
form1.heigth = heightParam
end sub
Now, if you want to return somthing, lets say you want to calculate the Kelvin temperature from Celsius:
vb
private function CtoK(cTemp as double) as single
' The above line says it's a function available in this form, it's name is CtoK,
' it takes one parameter - a double and it does return one single.
CtoK = cTemp + 273.15
end function
'Somewhere in your program...
kelvinTemperature = CtoK(celsiusTemperature)
This should show how to use functions and parameters.
/Jens