[英]How to get Devexpress LookupEdit Value Member Value?
Hi Im using devexpress . 嗨,我正在使用devexpress。 I want to know how to get the value member value in lookupEdit. 我想知道如何在lookupEdit中获取值成员值。 I set the DisplayMember as prior to SupplierName And ValueMember to SupplierID 我将DisplayMember设置为SupplierName和ValueMember之前的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 下面的代码在lookupedit中将文本和SupplierName都显示为文本。我想要的是将SupplierName保留为Display,但是我想在将其保存到数据库时获取vendorID
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 我想要供应商ID的值,例如001-Supplier1查找中的显示文本是Supplier1我想要的是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
要获取选定的值,您可以简单地执行txtSupplier.EditValue
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.