Completed
Last Updated: 20 Mar 2015 11:37 by ADMIN
ADMIN
Dimitar
Created on: 03 Feb 2015 08:34
Category: Editors
Type: Bug Report
0
FIX. RadAutoCompleteBox - ArgumentOutOfRangeExeption when item is added in the Validating event and the data source is reset in the LostFocus event.
To reproduce:
AddHandler RadAutoCompleteBox1.Validating, Sub()
                                               'add new item to list
                                               Dim txt As String = RadAutoCompleteBox1.Text
                                               Dim add As String = String.Empty
                                               If Not String.IsNullOrEmpty(txt) Then
                                                   If Not txt.EndsWith(";") Then
                                                       'new item!
                                                       If txt.Contains(";") Then
                                                           _addWg = txt.Split(";").Last
                                                       Else
                                                           _addWg = txt
                                                       End If
                                                       RadAutoCompleteBox1.Text = RadAutoCompleteBox1.Text & ";"
                                                   End If
                                               End If
                                           End Sub

'---------------
'We update the datasource when we lost focus....
AddHandler RadAutoCompleteBox1.LostFocus, Sub()
                                              If Not String.IsNullOrEmpty(_addWg) AndAlso Not wgAcSource.Contains(_addWg) Then
                                                  wgAcSource.Add(_addWg)
                                                  RadAutoCompleteBox1.AutoCompleteDataSource = Nothing
                                                  RadAutoCompleteBox1.AutoCompleteDataSource = wgAcSource
                                                  _addWg = String.Empty
                                              End If

                                          End Sub


Workaround:
Add the item and reset the data source in the KeyDown event for example when the user presses Enter.
0 comments