Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I have a LookUpEdit control that I populate using the following code:

                                            Dim myDB As New DBAccess

                                    If myDB.Connect(RISData.Instance.ProjectDB) = False Then
                                                Exit Sub
                                            Else
                                                Dim myDA As New SqlClient.SqlDataAdapter("spQryStatus", myDB.myConn)
                                                myDA.SelectCommand.CommandType = CommandType.StoredProcedure
                                                Dim myDS As New DataSet("ReviewStatus")
                                                myDA.Fill(myDS, "ReviewStatus")

                                    Me.cmbStatus.Properties.DataSource = New BindingSource(myDS, "ReviewStatus")
                                                Me.cmbStatus.Properties.DisplayMember = "statusName"
                                                Me.cmbStatus.Properties.NullText = ""
                                                Me.cmbStatus.Properties.ValueMember = "ID"

                                    Me.cmbStatus.Properties.DropDownRows = myDS.Tables("ReviewStatus").Rows.Count

                                    myDA.Dispose()
                                                myDS.Dispose()

                                    'Me.cmbStatus.Properties.PopupWidth = Me.cmbStatus.Properties.Columns(1).Width
                                            End If

                                    What I want to do is loop through the LookUpEdit control and return the ValueMember for each row in the dropdown.

                                    Thanks

                                    Simon

                                • It's probably easiest to just get a reference to the DataTable the LookUpEdit is bound to.

                                  DataTable statusDataSource = cmbStatus.Properties.DataSource as DataTable;

                                  foreach(DataRow statusRow in statusDataSource.Rows)
                                  {
                                       int StatusID = Convert.ToInt32(statusRow["ID"]);
                                  }

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                The easiest way to accomplish this task is to traverse directly through your datasource rows as Brendon suggested:

                                [C#]
                                DataTable statusDataSource = cmbStatus.Properties.DataSource as DataTable; foreach(DataRow statusRow in statusDataSource.Rows) { int StatusID = Convert.ToInt32(statusRow["ID"]); } Processed, T
                                You must  log in  or  register  to leave comments

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners