views:

94

answers:

2

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

**

A: 

Your control should have a Class property. That should give you enough information to determine what type it is. I know this is available to the Control class in Access itself, but I'm not sure about vb.net.

Example (A case statement would be needed to address all of them):

  If oCtl.Class = "AX2Controls.wsAX2Text" then
     iAX2Text = iAX2Text + 1
  End if
Jeff O
A: 

Ask for the type of the control:

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