This is a migrated thread and some comments may be shown as answers.

Change selectedItem in SelectedIndexChanged event

5 Answers 237 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
OD
Top achievements
Rank 1
OD asked on 06 Oct 2015, 09:43 AM

Hey,

I want to change the selected item selected by the user by an another item.

I put the following code, but the selected item is not changed :/

Private Sub myCombo_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles myCombo.SelectedIndexChanged​

                ​myCombo.EditorControl.CurrentRow = myCombo.EditorControl.Rows(myNumRow)
                myCombo.EditorControl.CurrentRow.IsSelected = True
                myCombo.EditorControl.CurrentRow.IsCurrent = True

End sub

Do you have an idea pls ?

NB : I'm on Q1 2015

5 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 07 Oct 2015, 11:13 AM
Hello ,

Thank you for writing.

You can directly set the selected index. For example:
Private Sub radMultiColumnComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
    If radMultiColumnComboBox1.SelectedIndex <> 2 Then
        radMultiColumnComboBox1.SelectedIndex = 2
    End If
End Sub

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
OD
Top achievements
Rank 1
answered on 08 Oct 2015, 12:45 PM

Thanks for your reply.

Your code works on a blank project but not on mine :/

Maybe, i'm using too many events on this control + a lightVisualElement.

I'll continue to investigate :)

 

0
Dimitar
Telerik team
answered on 09 Oct 2015, 12:28 PM
Hello ,

Take all the time you need to examine this and do not hesitate to contact us if you need further assistance.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
OD
Top achievements
Rank 1
answered on 09 Oct 2015, 01:37 PM

In fact, i wanted to cancel the selection of my item on a certain condition.

    Private Sub cmyCombo_CurrentRowChanging(ByVal sender As Object, ByVal e As CurrentRowChangingEventArgs) Handles myCombo.EditorControl.CurrentRowChanging
        If Not e.NewRow Is Nothing AndAlso e.NewRow.Cells(​Nom).Value = "" Then
            e.Cancel = True
myCombo.MultiColumnComboBoxElement.ClosePopup()
        End If

    End Sub

This code works :)

0
Dimitar
Telerik team
answered on 12 Oct 2015, 11:46 AM
Hi ,

I am glad that you have fond a solution for your case. Let us know if you have any other questions.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
MultiColumn ComboBox
Asked by
OD
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
OD
Top achievements
Rank 1
Share this question
or