You code it exactly like you have written it :)
If you need to call it from a button, then in your button click handler you merely call the function and update the value wherever you need to (i.e. a textfield or whatever).
C# doesn't have "procedures" - only functions. Functions that do not return a value are declared as returning "void", like so
public void someFunction(){
}
Ezzaral
Posting Genius
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847