commandbardropdownlist focus

3 posts, 1 answers
  1. ricric
    ricric avatar
    12 posts
    Member since:
    Sep 2010

    Posted 02 Mar 2011 Link to this post

    i have use CommandBarDropDownList1.DropDownListElement.EditableElement.TextBox.Focus() on form load, but the dropdownlist still can't focus. any solution?
  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Mar 2011 Link to this post

    Hello,

    If your DropDownStyle is set to DropDown, then this will do the trick for you

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.CommandBarDropDownList1.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown
    End Sub
    Private Sub Form1_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
        Me.CommandBarDropDownList1.DropDownListElement.TextBox.TextBoxItem.HideSelection = False
        Me.CommandBarDropDownList1.DropDownListElement.TextBox.TextBoxItem.SelectAll()
        Me.CommandBarDropDownList1.DropDownListElement.Focus()
    End Sub

    Hope that helps but let me know if you have any questions
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. ricric
    ricric avatar
    12 posts
    Member since:
    Sep 2010

    Posted 03 Mar 2011 Link to this post

    Thank you so much.
Back to Top