NullReferenceException

3 posts, 1 answers
  1. Abbas
    Abbas avatar
    13 posts
    Member since:
    Oct 2012

    Posted 09 Mar 2015 Link to this post

    Hello dear Dimitar,

    There is a amazing program which has been developed by you. "Use custom filtering to search in all columns of RadMultiColumnComboBox".
    http://www.telerik.com/support/kb/details/use-custom-filtering-to-search-in-radmulticolumncombobox
    It is very good, handy and really wow.
    But when you hit enter key on MultiColumnComboBox for 3 times, you get an NullReferenceException exception.
    Can you fix it?

    Thanks
    Regards,
    Abbas
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1411 posts

    Posted 11 Mar 2015 Link to this post

    Hi Abbas,

    Thank you for writing.

    I was able to reproduce the observed exception. To avoid this behavior you can handle the enter key only when the popup is shown:
    void radMultiColumnComboBox1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == System.Windows.Forms.Keys.Enter && radMultiColumnComboBox1.MultiColumnComboBoxElement.IsPopupOpen)
        {
            if (this.radMultiColumnComboBox1.ValueMember != "")
            {
                radMultiColumnComboBox1.SelectedValue = radMultiColumnComboBox1.EditorControl.CurrentRow.Cells[radMultiColumnComboBox1.ValueMember].Value;
            }
            else
            {
                radMultiColumnComboBox1.SelectedValue = radMultiColumnComboBox1.EditorControl.CurrentRow.Cells[radMultiColumnComboBox1.DisplayMember].Value;
            }
     
            radMultiColumnComboBox1.Text = radMultiColumnComboBox1.EditorControl.CurrentRow.Cells[radMultiColumnComboBox1.DisplayMember].Value.ToString();
            radMultiColumnComboBox1.MultiColumnComboBoxElement.ClosePopup();
            radMultiColumnComboBox1.MultiColumnComboBoxElement.TextBoxElement.TextBoxItem.SelectAll();
        }
     
    }

    I will fix this in the article as soon as possible. I have updated your Telerik Points for this report.
     
    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Abbas
    Abbas avatar
    13 posts
    Member since:
    Oct 2012

    Posted 12 Mar 2015 Link to this post

    Hi dear Dimitar,

    I really appreciate your help and support.

    Thanks,
    Regards,
    Abbas
Back to Top