Depending on the object and path given, it has obtained its descendants.

xiaoxiao2021-03-06  43

/// If not specified, it published technical articles are original, anyone references please indicate the source and include this statement /// Author: 9CBS screen name alias88, e-mail: alias88 @ 163.com, QQ : 63343

/// Usage such as: /// 1 Object obj = getmember (frmmain, "txtname", null); /// (Obj as control) .Text = "Hello!" // is equivalent to frmmain.txtname.text = " Hello! "/// 2 Object obj = getmember (frmmain," txtname.text ", null; /// string text = obj.tostring (); // is equivalent to text = frmmain.txtname.text

///

// / According to a given object and path, obtain its descendants /// /// The member to be obtained is the descendants of this object, general Gets for Form /// , for example: TextBox1 or TextBox1.size /// can be used with index attributes Selecting index value Returns /// public static object getmember (object ptopobject, string pobjpath, object [] index)

{

String [] Strmember;

String membername = "";

Object obj = NULL;

TYPE OBJTYPE = NULL;

Try

{

Strmember = POBJPATH.SPLIT ('.');

For (int i = 0; i

Pobjpath, MemberName, EX.MESSAGE

System.console.writeLine (Errmsg);

Return NULL;

}

}

转载请注明原文地址:https://www.9cbs.com/read-74061.html

New Post(0)