none
how to select index on comboBox RRS feed

  • Question

  • hi

    i have comboBox that i fill in data like this:

             

    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;

    how to select the comboBox where the Mycom.ValueMember = 33

    (something like  Mycom.SelectedIndex = ???)

    Wednesday, May 30, 2012 6:02 AM

Answers

  • You can probably use Mycom.SelectedItem = 33

    If not then find item at which index meets your condition and then use Mycom.SelectedIndex to set it.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by E_gold Wednesday, May 30, 2012 9:50 AM
    Wednesday, May 30, 2012 6:39 AM
    Moderator