Hello, I'm trying to better acquainted with Cocoa and Obj-C, having some trouble with simple things. Perhaps someone could kindly apply cluebat to skull for me. I'm accepting a couple of string values from a pair of NSTextField and would like to take these values and do some math with them, then display them back in a Label.
.... NSString *aString = aField.text; NSString *bString = bField.text; NSDecimalNumber *aAmt = [NSDecimalNumber decimalNumberWithString:aString]; NSDecimalNumber *bAmt = [NSDecimalNumber decimalNumberWithString:bString]; NSDecimalNumber *myTotal; NSDecimalNumber *myPct; NSDecimalNumber *multFactor; myPct = [bAmt decimalNumberByDividingBy:100]; // divide by 100 to get % ( 0.XX ) multFactor = [myPct decimalNumberByAdding:1]; // add 1 so we can multiply by 1.XX newAmt = [bAmt decimalNumberByMultiplyingBy:myPct]; myTotal = [aAmt decimalNumberByAdding:bAmt]; aLabel.text = newAmt; bLabel.text = myTotal; [aString release]; .... None of this works, at all. So how to I grab 2 strings from text fields, extract their numerical value, do some math, then apply them to labels? Regards, Brooke _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]