ComponentOne List for WinForms
In This Topic
    Selecting a Row by Data
    In This Topic

    To select a row by a value in a specific row, use the SelectedValue property.

    1. Bind the DataSet to the C1List component.
    2. Set the following properties in the Properties window:
      Property Value
      C1ListBase.DisplayMember Company
      C1ListBase.ValueMember Phone

      Or in code, add the following to the Form_Load event:

      To write code in Visual Basic

      Visual Basic
      Copy Code
       Me.C1List1.DisplayMember = "Company"
       Me.C1List1.ValueMember = "Phone"
      

      To write code in C#

      C#
      Copy Code
      this.c1List1.DisplayMember = "Company";
      this.c1List1.ValueMember = "Phone";
      
    3. Use the SelectedValue property to set the row value. In this example, the value is 4123210030, the phone number of Ann Quinn at Software Designs. Add the following code to the Form_Load event:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      Me.C1List1.SelectedValue = 4123210030
      

      To write code in C#

      C#
      Copy Code
      this.c1List1.SelectedValue = 4123210030;
      

    This topic illustrates the following:

    When finished, run the application. The result will look like this, with the SelectedValue highlighted.