Set Selection based on initial value from database

5 posts, 1 answers
  1. Gone2TheDogs
    Gone2TheDogs avatar
    22 posts
    Member since:
    May 2016

    Posted 26 Oct Link to this post

    After I load my MultiColumnCombobox using a dataset. How do I set the value after a record is pulled from the database? I want to use Column(0)

    Column(0) = ID

    Column(1) = Desc

     

     

    Initial Load:   mcboApCashTerms.DataSource = dsTerms.Tables(0)

    User pulls record from database: rec.CashTermId = "24"

    How to do go to the row where Column(0) = "24" ?

     

     

  2. Gone2TheDogs
    Gone2TheDogs avatar
    22 posts
    Member since:
    May 2016

    Posted 26 Oct in reply to Gone2TheDogs Link to this post

    I found a way of finding the value using a loop, but is there a more efficient method?

    1.For x As Integer = 0 To mcboApCashTerms.EditorControl.Rows.Count - 1
    2.    If mcboApCashTerms.EditorControl.Rows(x).Cells(0).Value = TermCD Then
    3.        mcboApCashTerms.SelectedIndex = mcboApCashTerms.EditorControl.Rows(x).Index
    4.        Exit For
    5.    End If
    6.Next
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Answer
    Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    712 posts

    Posted 26 Oct Link to this post

    Hi Bob,

    Thank you for writing.

    The approach you shared is valid. Alternatively and depending on your actual scenario you can also perform a query against your data source object and directly set the returned index as selected to your RadMultiColumnCombobox control.

    I hope this helps. Please let me know if you need further assistance.

    Regards,
    Hristo Merdjanov
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  5. Gone2TheDogs
    Gone2TheDogs avatar
    22 posts
    Member since:
    May 2016

    Posted 26 Oct in reply to Hristo Merdjanov Link to this post

    Thanks for confirming, Hristo!

    I'm interested in using the dataset, but haven't used this method before. If it isn't too much trouble. what would that look like? Otherwise, I'll do some Internet browsing.

     

     

  6. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    712 posts

    Posted 27 Oct Link to this post

    Hi Bob,

    Thank you for writing back.

    I see that you are using a data table so you can check the following threads discussing a similar matter: 
    I hope this helps. Please let me know if you need further assistance.

    Regards,
    Hristo Merdjanov
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
     
Back to Top
UI for WinForms is Visual Studio 2017 Ready