how to select value from multicolumn combobox??

2 posts, 1 answers
  1. mampus
    mampus avatar
    24 posts
    Member since:
    Oct 2010

    Posted 06 Jan 2011 Link to this post

    Hi there....

    I tried to select value from editor control then pass that to a textbox...
    i'm already tried this from documentation:

        Dim test As String
        test = String.Format("Row changed, current Name = {0}", RadMultiColumnComboBox1.EditorControl.Rows(RadMultiColumnComboBox1.SelectedIndex).Cells("ContactName").Value)
    textbox1.text = test

    that code return me an error like this:

    "Object reference not set to an instance of an object."

    What should i do??

  2. Answer
    Jack
    Admin
    Jack avatar
    2335 posts

    Posted 10 Jan 2011 Link to this post

    Hi mampus,

    Thank you for contacting us.

    The described code looks OK and it should work when there is a selected item it the control. You should also check whether the cell is empty. I modified your code slightly:
    If Not RadMultiColumnComboBox1.SelectedIndex >= 0 Then
        Dim value As Object = RadMultiColumnComboBox1.EditorControl.Rows(RadMultiColumnComboBox1.SelectedIndex).Cells("ContactName").Value
        If Not value Is Nothing Then
            Dim test As String
            test = String.Format("Row changed, current Name = {0}", value)
            textbox1.text = test
        End If
    End If

    I hope this helps. If the issue continues to appear, please send us your application and we will try to locate it and find a suitable solution.

    I am looking forward to your reply.

    Best wishes,
    Jack
    the Telerik team
    Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top