【问题标题】:Select a column on current row on DevExpress lookupedit bound to entity在绑定到实体的 DevExpress 查找编辑中选择当前行上的一列
【发布时间】:2014-03-03 19:42:53
【问题描述】:

我在 VB.net 2013 和 DevExpress 控件上使用实体框架。
我有一个标准组合框(Microsoft 控件)和一个 DevExpress LookupEdit,两者都绑定到 MyBindingSource( DisplayMember : Name , ValueMemeber : id)

MyBindingsource.Datasource = (From t in context.MyTable Select t.id, t.name, t.vl select t).ToList

现在在普通组合框(Microsoft 控件)上,我使用此代码在进行选择时显示 vl 字段的值:

Private Sub Combo1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Combo1.SelectedIndexChanged
    MessageBox.show ( Me.Combo1.SelectedItem.vl )
End Sub

我怎样才能在 Lookupedit 上做同样的事情?

【问题讨论】:

    标签: vb.net winforms devexpress lookup


    【解决方案1】:

    这2种方法会给你想要的...

    var row = lookUpEdit1.GetSelectedDataRow(); // gives you the selected object
    
    var v1Value= lookUpEdit1.Properties.GetDataSourceValue("v1",lookUpEdit1.ItemIndex);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多