如何从BindingSource获取DataMember [英] How to get DataMember from a BindingSource

查看:292
本文介绍了如何从BindingSource获取DataMember的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想以表格的形式获取BindingSources的名称.下面的过程向我表明我有两个,但是我需要它们的名称/数据成员:

Hi,

I would like to get the names of the BindingSourcesin my form. The procedure down here shows me that I have two of them, but I need their names/datamembers:

Dim i As Integer = 0
For Each c As System.ComponentModel.IComponent In Me.components.Components
  If TypeOf (c) Is BindingSource Then
    MsgBox("found " & i)
    i += 1
    'I want the DataMember of this BindingSource here
  End If
Next


推荐答案

我不知道为什么要向用户显示内部对象的名称,但是...
I have no idea why you would be showing the user the names of internal objects, but...
For Each c As IComponent In Me.components.Components
    If TypeOf(c) Is BindingSource Then
        MsgBox("Found DataMember: " & DirectCast(c, BindingSource).DataMember)
    End If
Next


这篇关于如何从BindingSource获取DataMember的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆