Pri*_*Jea 1 vb.net devexpress winforms repositorylookupedit
嗨我正在使用devexpress.我想知道如何在lookupEdit中获取值成员值.我将DisplayMember设置为SupplierName和ValueMember之前的SupplierID
下面的代码显示了两个和SupplierName作为lookupedit中的文本..我想要的是将SupplierName保持为显示但我想在将它保存到数据库时获取supplierID
场景:
我想要供应商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
Run Code Online (Sandbox Code Playgroud)