2012-05-30 3 views
0

에 선택 인덱스에 대해 상담을하고 싶어 :은 내가 이런 식으로 데이터를 입력으로 comboBox 있습니다으로 comboBox

SQL = "select DISTINCT ActionNum,ActionName from ActionType"; 
adp = new SqlCeDataAdapter(SQL, Main.Conn); 
adp.Fill(dsView, "ActionType"); 
adp.Dispose(); 
Mycom.DataSource = dsView.Tables[0]; 
Mycom.DisplayMember = dsView.Tables[0].Columns[1].ColumnName; 
Mycom.ValueMember = dsView.Tables[0].Columns[0].ColumnName; 

방법을 선택하는 콤보 상자를 어디에 같은 Mycom.ValueMember = 33

(뭔가 Mycom.SelectedIndex = ?? ?)

답변

1

콤보 박스의 경우 msdn을 참조하십시오.

http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.aspx

SelectedIndex Gets or sets the index specifying the currently selected item. (Overrides ListControl.SelectedIndex.) 
SelectedItem Gets or sets currently selected item in the ComboBox. 
SelectedText Gets or sets the text that is selected in the editable portion of a ComboBox. 
SelectedValue Gets or sets the value of the member property specified by the ValueMember property. (Inherited from ListControl.)