InvokeMember throws an exception

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ralfeus

    InvokeMember throws an exception

    Hi all.
    I'm developing a software for Windows Mobile 2003. I have such code:
    Control currControl = formControls[ArrayPosition]
    [currElement];
    if (elementType.Ge tProperty("Item s") != null)
    {
    Type itemsType =
    elementType.Get Property("Items ").PropertyType ;
    object itemsObj =
    elementType.Inv okeMember("Item s",
    BindingFlags.In stance |
    BindingFlags.De claredOnly |
    BindingFlags.Pu blic |
    BindingFlags.No nPublic |

    BindingFlags.Ge tProperty,
    null, currControl, null);
    foreach (XmlNode item in
    element.FirstCh ild.ChildNodes)
    {
    itemsType.Invok eMember("Add",
    BindingFlags.In stance |
    BindingFlags.Pu blic |

    BindingFlags.In vokeMethod,
    null, itemsObj, new
    Object[] {item.Value});
    }
    }

    The row InvokeMember("I tems",... throws an exception
    NotSupportedExc eption. As far as I understand if the property "Items"
    could be gotten (elementType.Ge tProperty("Item s") != null) it's should
    be possible to invoke it. Did I miss something?
    Thanks.
    Mykhaylo

Working...