Hi all
I'm trying to put together a method to loop through all controls on a
form and see if any of them are databound.
For simple binding this seems to be straight forward enough (by
checking the control.Bindings collection as in the example below), but
this doesn't work for combo boxes or datagridviews (and probably
numerous other items).
Does anyone know how I can check any type of control to establish
whether it's bound or not - whether it's simple or complex binding?
Thanks a lot in advance
Martin
Code snippet to check for simple binding - this would be called for
each control on a form:
'================
Public Sub GetBoundControls(ByVal caller As Control)
Dim ctl As Control
For Each ctl In caller.Controls
If ctl.DataBindings.Count > 0 Then
' do some work here
End If
Next
End Sub
'================
Roger Tranchez - 07 Sep 2007 11:00 GMT
Hi,
What if you Check its DataSource being Nothing / Null ?

Signature
Roger Tranchez
MCTS
.NET 2005 and DB developer
> Hi all
>
[quoted text clipped - 25 lines]
> End Sub
> '================