2012-11-01 3 views
-3

누군가이 동작을 설명 할 수 있습니까?콤보 상자 여러 항목 선택

enter image description here


뿐만 아니라합니까 MouseOver 강조 여러 항목 (아니다),하지만 난 (마우스가 이상임을) 코드는 오른쪽에있는 사진을 변경 Selection_Changed 이벤트에가는 항목을 Select 때 그것의 (예정대로)하지만 그림을로드하는 동안 경로에 잘못된 문자가 있다는 오류 메시지가 나타납니다.

public List<String> GetListOfShapes() 
    { 
     List<String> iList = new List<String>(); 
     try 
     { 
      GetConnectionString iGet = new GetConnectionString(); 
      System.Data.OleDb.OleDbConnection iConnect = new System.Data.OleDb.OleDbConnection(); 
      iConnect.ConnectionString = iGet.ConnectionString(); 
      iConnect.Open(); 
      System.Data.OleDb.OleDbCommand iCommand = new System.Data.OleDb.OleDbCommand(); 
      iCommand.Connection = iConnect; 
      iCommand.CommandText = "Select ShapeName from Shapes "; 
      System.Data.OleDb.OleDbDataReader iRead = iCommand.ExecuteReader(); 
      while (iRead.Read()) 
      { 
       Shape iShape = new Shape(); 
       iShape.ShapeName = iRead["ShapeName"].ToString(); 
       iList.Add(iShape.ShapeName); 
      } 

     } 
     catch 
     { 
      MessageBox.Show("Someone better call batman or something `\\(^_^)_/`"); 
     } 
     return iList; 
    } 
BD.Shape xShape = new BD.Shape(); 
comboBoxShapes.ItemsSource = xShape.GetListOfShapes(); 


enter image description here


내가 거기에 대시 -와 다른 것을 선택하면 그것은 단지 하나 개의 항목을 선택 있습니다. 숨겨진/잘못된 문자가 없습니다 ....

+0

계속 말씀하시는 "it"이 무엇인지 설명하십시오. ("It"은 코드를 실행합니다 ... "it"는 ... "it"은 하나의 항목 만 선택합니다 ...) –

+0

그러면 가정하는 것보다는 질문을 업데이트하십시오. 콤보 박스의 선택 모드는 무엇입니까? 바닥에있는 샘플은 무엇입니까? – Paparazzi

+0

선택 모드가 dropdownlist로 설정되어 있습니까? – Derek

답변

1

데이터에 개행 문자가 없습니까?

해당 목록에있는 항목 수를 디버깅하십시오.

string same = "same" + Environment.NewLine + "next Line"; 
List<string> lstring = new List<string> { "one", "two - a", "two - b", "three", "three", same, same }; 
cb1.ItemsSource = lstring; 

설명하는 선택 동작이 있습니다.

+0

새 행만 \ n에 의해 생성 될 수 있습니까? –

+0

LOL, 내가 오류 코드를 찾고 있었어, 액세스 데이터베이스에서 sonora가 (스크린 샷과 같이) 1 행이라는 것을 보여 주지만, 강조 표시하고 아래로 내려 가면 세도나가 나옵니다. 행의 높이 때문에 그것을 볼 수 없었습니다 -_- –

+0

@JustinKirk 예 많은 방법 – Paparazzi

관련 문제