.net – How to Bifurcate Activex controls present in access DB Form using vb.net

ms-accessvb.net

Using my tool (vb.net) I am able to count Activex controls present in a access DB Form. Is it possible to bifurcate the controls? i.e. I want to count activex controls separately.

e.g. If there are total 10 Activex Controls, out of which 5 are calender control and 5 are check boxes. Then I need to count separately.

Is it possible? Please suggest.

To calculate Activex controls I am using the following code…..

**

oCtls = oForm.Controls
   intObjectCount = 0
   For Each oCtl In oCtls
      If oCtl.ControlType = 119 Then 'Activex Control'
        intObjectCount = intObjectCount + 1
      End If
    Next

**

Best Answer

Ask for the type of the control:

If TypeOf oCtl Is System.Windows.Forms.CheckBox then
   CheckBoxCount +=1
end if