Hi Im using devexpress . I want to know how to get the value member value in lookupEdit. I set the DisplayMember as prior to SupplierName And ValueMember to SupplierID
The code below displays both and SupplierName as the text in lookupedit.. what I want is to keep the SupplierName as the Display but I want to get the supplierID when saving it to database
Scenario:
I want the value of the Supplier ID for example 001 - Supplier1 The display text in the look up is Supplier1 what I want is the 001
Private Function LoadSupplierData()
Dim bResult As Boolean
Dim SQLcmd As New System.Text.StringBuilder
SQLcmd.AppendLine("SELECT SupplierID,SupplierName ")
SQLcmd.AppendLine("FROM Supplier ")
SQLcmd.AppendLine("WHERE Status='Active'")
Try
Using SQLconnect As New SqlConnection(g_constring)
Using SQLadapter As New SqlDataAdapter(SQLcmd.ToString, SQLconnect)
Dim ds As New DataSet
SQLadapter.Fill(ds, "SupplierDetails")
Dim dvm As DataViewManager = New DataViewManager(ds)
dvMain = dvm.CreateDataView(ds.Tables("SupplierDetails"))
End Using
End Using
txtSupplier.Properties.DataSource = dvMain
Catch ex As Exception
MessageBox.Show(ex.Message.Trim, "Error in database", MessageBoxButtons.OK, MessageBoxIcon.Stop)
bResult = False
End Try
Return bResult
End Function
To get the selected value you could simply do txtSupplier.EditValue