1
가 나는 기본 값과 표시 값과이 방법을 내 콤보 상자를 채우는 해요 :comboBox에서 포함 된 값을 추출하는 방법은 무엇입니까?
Dictionary<int, string> Platypi = duckBillData.GetPlatypiVals();
comboBoxPlatypus.DataSource = new BindingSource(Platypi, null);
comboBoxPlatypus.ValueMember = "Key";
comboBoxPlatypus.DisplayMember = "Value";
지금 내가 선택한 항목의 ValueMember을 추출 할. 어떻게해야합니까? 가 아닌,
int id = comboBoxPlatypus.ValueMember;
int id = comboBoxPlatypus.SelectedIndex. <-- no "ValueMember" here...
int id = comboBoxPlatypus.SelectedItem. <-- no "ValueMember" here...
실제로 다음과 같이 사용합니다. int callFlowID = (int) comboBoxCallFlow.SelectedItem; "System.InvalidCastException 처리되지 않았습니다. 메시지 = 지정한 캐스트가 유효하지 않습니다." –
사전에있는 키 (또는 ValueMember로 지정한 항목)가 여전히 int입니까? –
이것은 또한 실패합니다 : int callFlowID = Convert.ToInt32 (comboBoxCallFlow.ValueMember); ... ValueMember의 값이 "Key"... ??? –