2
나는 일반적인 필드 개체가 있습니다어떻게 winforms에서 일반적인 개체 바인딩을 사용합니까?
public class Field
{
public string Name { get; set; }
public string oldName { get; set; }
private object _Value = null;
public object Value
{
get
{
return _Value;
}
set
{
_Value = value;
}
}
private FieldType _fieldType = FieldType.Normal;
public FieldType FieldType
{
get
{
return _fieldType;
}
set
{
_fieldType = value;
}
}
private bool _isKey = false;
public bool IsKey
{
get
{
return _isKey;
}
set
{
_isKey = value;
}
}
}
공통 기록 개체 : 데이터베이스에서
public class Record
{
public string TableName{get;set;}
pubilc FieldCollection _fieldcollection = new FieldCollection();
public FieldCollection FieldCollection
{
get
{
return _fieldcollection;
}
set
{
_fieldcollection = value;
}
}
}
데이터가 기록 개체로 변환 한 다음 내가 컨트롤에 기록 데이터를 바인딩하려는 ,하지만 작동하지 않습니다. 나는 내가 좋아하는 데이터 바인딩하는 방법을 알고 싶어 :
textBox1.DataBindings.Add("Text", listBox1.DataSource , "BarDesc");
3ku하지만 실제 필드 이름은 Record.FieldCollection [i] .FieldName! DataMember를 바인딩하는 방법 : public 바인딩 (string propertyName, Object dataSource, string dataMember) – MarcoRui
이제 저의 가정 시간입니다.하지만 아무도 뛰어들지 않는 경우 더 나은 대답이 여기에 있습니다. http : //www.codeproject .com/Articles/15596/BindingSource-and-BindingNavigator-in-C-2-0 –