RadListBox doesn't highlight the selected line

3 posts, 0 answers
  1. deng bruce
    deng bruce avatar
    5 posts
    Member since:
    Mar 2010

    Posted 10 May 2011 Link to this post

    as:
    {
       listBox.DataSource = m_dtRequisition;
       listBox.DisplayMember = "FileName";
       listBox.ValueMember = "RequisitionGuid";
    }




    when i should select the last index for radlistbox,  but why the listbox doesn't highlight the selected line? 
    {
       DataTable dt = listBox.DataSource as DataTable;
       listBox.selectedindex = dt.Rows.Count;
    }
  2. deng bruce
    deng bruce avatar
    5 posts
    Member since:
    Mar 2010

    Posted 10 May 2011 Link to this post

    It is ok as

     DataTable dt = listBox.DataSource as DataTable;
                    if (dt.Rows.Count > 0)
                    {
                        listBox.SelectedIndex = dt.Rows.Count - 1;
                    }
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 12 May 2011 Link to this post

    Hello deng,

    Thank you for the writing.

    Indeed, in order to select the last item, you should set the SelectedIndex to the Count minus one. I am glad that you have found the answer to the question.

    I would like to let you know that RadListBox control is obsolete since Q2 2010. Once we release Q2 2011, this control will no longer be supported. This is why, it is highly recommendable to upgrade to its ancestor - RadListControl.

    Best wishes,
    Peter
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Back to Top