本文介绍了如何从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


推荐答案

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 05:06