[IronPython] Doing Simple Math In Silverlight

Andrew Evans andrew.canit at gmail.com
Fri May 15 00:58:42 CEST 2009


Just a quick question also

is it possible to connect to a mysql database through silverlight and Iron
Python

And if so anyone have an example


*cheers

On Thu, May 14, 2009 at 3:34 PM, Andrew Evans <andrew.canit at gmail.com>wrote:

> 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 <fuzzyman at voidspace.org.uk>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
>>> Users at lists.ironpython.com
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>
>>>
>>
>>
>> --
>> http://www.ironpythoninaction.com/
>> http://www.voidspace.org.uk/blog
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090514/810c9eb7/attachment.html>


More information about the Ironpython-users mailing list