>i don't know how i can save the code at function library or in a prg file.
any example.
In command window write MODIFI COMMAND it will open an editing window where you can write the code. Save it with any name like CustFunc.
You can use it in your main.prg or in form's init method as follows
set procedure to custfunc additive
Zaheer