grid selection

If I have a grid on a form or subform of a form, is there a way in code to determine what rows the user has highlighted? I want to do some processing on each one that they have selected, and not the unselected ones. I have only been able to get the last row that was highlighted. Thanks in advance

example on sales order… IF CurrForm.FORM.SalesLines.MyfunctionToGetSelected (mySalesLineRecord); on the subform MyFunctionToGetSelected (var mysaleslines record sales line); CurrForm.SETSELECTION(mysaleslines);

Thanks for the info!