formstextboxironpythonsharpdevelop

IronPython error, "'TextBox' object has no attribute 'text'" when using a ShowDialog() method created in SharpDevelop


I am trying to call a form designed in SharpDevelop within another IDE. I get the following error message: 'TextBox' object has no attribute 'text'. This happens when I run the script which includes the lines shown below in the other IDE. Is the problem in the script itself or in the Form1 class written in SharpDevelop? How can I resolve this?

import myform
import System

f = myform.Form1()
if f.ShowDialog() == System.Windows.Forms.DialogResult.OK:
    dx = f._directionx.text
    dy = f._directiony.text
    dz = f._directionz.text
    nb = f._nbofiterations.text
    w = f._width.text
    h = f._height.text

Solution

  • Since it appears that you're using IronPython (the System.Windows.Forms gave it away) I'm guessing that your TextBox is a Forms element.

    If this is so, you need the .Text property - everything (properties, functions/methods that I know of) in the .NET library starts with an uppercase letter.