How to Validate the Output Values

Can you Explain me How to Validate the Output Values which Comes in Textbox Fields or that gets reflected in the Grid when we me give some inputs and where our code change the Output that comes. To be Clear i will explain with an example

I have three text box fields like Val1,Val2 and Result field and there is Add button which will add the given input values in val1 and val2 and displays the final result in Result Text field.Now i want to validate the Value which comes in the Result fields to check whether the Add button Functionality is working fine or not. So How can i capture the value in the Result Text field each time when i change the input values and validate the result.

Kindly Provide me some Code Snippet

Click "Result field"
TypeText controlkey, "a" // select all
typetext controlKey, "c" // copy the contents to the clipboard
put remoteClipboard() into resultVal
if resultVal is not equal to expectedVal
    logError "bad math"
end if