Convert current selected item to datarow

2 posts, 0 answers
  1. michael knight
    michael knight avatar
    1 posts
    Member since:
    Feb 2010

    Posted 11 May 2011 Link to this post

    There is a nice useful snippet when using standard MS combobox to track current selected item in a table based on the current selected item of the combobox. This snippet can be accessed using VS 2008 and upward i dont know about 2005. (InsertSnippet> Data - LinQ/XML/Desinger/ADO.NET blah blah> Designer Features and ADO.net> ConvertBindingsource.Current to a specific row in a DataTable)

    Using the standard VS shipped combobox it works giving me the option to define it like this:
    Dim row As MyProjectDataSet.tblStaffRow<br>        row = CType(CType(Me.ComboBoxStaff.SelectedItem, DataRowView).Row, MyProjectDataSet.tblStaffRow)
    and then Dim for example put it into a variable like:
    myArrayVariable.Add(row.StaffName)

    This however doesn't work for telerik q1 2011 winform RadDropDownList. can anyone help me with this?
  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 16 May 2011 Link to this post

    Hi michael knight,

    You should cast the SelectedItem.DataBoundItem to DataRow. Consider the following example:

    Dim row As MyProjectDataSet.tblStaffRow<br>        row = CType(CType(Me.ComboBoxStaff.SelectedItem.DataBoundItem, DataRowView).Row, MyProjectDataSet.tblStaffRow)

    I hope this helps.

    Kind regards, Peter
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top