combobox
대신 dataRawView
값을 얻으므로 dataset
을 combobox
(cbMissAtt
)에 바인딩 할 수 있습니까?콤보 상자에 데이터 바인딩 바인딩
무엇이 누락 되었습니까? 나는 이것에 대한 많은 답을 읽었으나 그것을 통해 내 길을 찾지 못했다. (DisplayMember를 설정하기 위해 실종되었다는 것을 알았지 만이 특별한 예를 위해 그것을 어떻게 수행해야할지 모르겠다.)
p.s. xml
에서 처음으로 cb를 채우려는 중 어딘가에서이 코드를 발견했습니다.
DataSet ds = new DataSet();
DataTable dt = new DataTable("Root");
dt.Columns.Add("text");
dt.Columns.Add("value");
ds.Tables.Add(dt);
foreach (DataColumn dc in dt.Columns)
{
dc.ColumnMapping = MappingType.Attribute;
}
//after I am reading and later closing stream
//part of code is missing because I think
//its not relevant for the question/answer(hopefully)
cbMissAtt.DataSource = ds.Tables[0];
매우 간단 xml
:이 값을 표시한다
cbMissAtt.DataBindings.Clear();
cbMissAtt.DataSource = ds.Tables[0];
cbMissAtt.DisplayMember = "value";
cbMissAtt.ValueMember = "text";
:
<?xml version="1.0" encoding="UTF-8"?>
<Root>
<Field text="text.." value="dedication"></Field>
</Root>
나는이 메소드를 호출하고 당신은 아래에이 코드를 시도 할 수 있습니다 constructor
제 경우에는 이것이 작동하지 않습니다. (데이터 세트가 괜찮다고 생각합니다. https://www.codeproject.com/Articles/6233/Populating-a-drop-down-control-from-an-XML-file –
그런 다음 문제는 데이터 소스에 있습니다. –
발견했습니다. 정말 어리석은 문제입니다. 도움을 주셔서 감사합니다. –