Hey guys thank you and thanks Michael will look into whitespace and error handling :-)
just wanted it to work :-P On Thu, May 14, 2009 at 3:21 PM, Michael Foord <[email protected]>wrote: > Andrew Evans wrote: > >> Hello >> >> I am trying to perform some math operations in Silverlight >> >> inputNum1 and inputNum2 are of TextBox >> >> inputNum1 = TextBox() >> inputNum2 = TextBox() >> >> result0 = int(inputNum1) + int(inputNum2) >> > That's because you can't cast text boxes to integers! > > You need something like: > > result0 = int(inputNum1.Text) + int(inputNum2.Text) > > You'll probably want to strip whitespace and also handle the error case > where what the user has entered is not a valid integer. > > HTH > > Michael > >> res0.Text = str(result0) >> >> I get the following error >> >> <http://go.microsoft.com/fwlink/?LinkID=124807> TypeError: expected int, >> got TextBox >> >> Any ideas >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> [email protected] >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >
_______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
