باز دو باره به مشکل بر خورد کردم
privatevoid SetValue(object Control)
{
object objValue = null;
object Value = null;
PropertyInfo pInfo = Control.GetType().GetProperty("Items");
if (pInfo != null)
{
Value = pInfo.GetValue(Control, null);
string[] strValues = objValue.ToString().Split(',');
ListItemCollection items = ((ListItemCollection)Value);
foreach (ListItem item in items)
foreach (string s in strValues)
if (s == item.Value)
item.Selected = true;
pInfo.SetValue(Control, (object)items, null);
}
}
به خط آخر که میرسه Error میده که : Property set method not found.
چرا؟
در ضمن pInfo.CanWrite مقدار false بر میگردونه!!!!!