views:

582

answers:

2

I am developing a Tool in vb.net and need find out Activex Controls from MS Access DB forms. I am able to conut number of controls in form, but unable to get the Activex Controls only from the form. Can any one have any idea how to achieve this, please suggest.

Thnaks,

+1  A: 

I am not sure what your are wanting is possible.
Try this: go into MS access and create new property that is the count of controls on the form. In VBA, me.Countrols.Count. Open the form using Access automation. OnFOrmLoad() write the number of controls to text file along with name of the form and then close the form. Afterwards open the text file in VB.net. It is indirect but it would work.

How To Automate Microsoft Access From Visual Basic .NET

To automate: Dim oAccess As Access.Application

' Start a new instance of Access for Automation: oAccess = New Access.ApplicationClass()

' Open a database in exclusive mode: oAccess.OpenCurrentDatabase(filepath:="c:\mydb.mdb", Exclusive:=True)

oAccess.DoCmd.OpenForm(FormName:="Employees")

garykindel
+1  A: 

Can you access the controltype property? If so, I cannot help with vb.net, but here is some VBA that may help.

ActiveXCount = 0
For Each ctl In Screen.ActiveForm
    If ctl.ControlType = 119 Then 'Custom control'
        'Debug.Print ctl.Class'
        ActiveXCount = ActiveXCount + 1
    End If
Next
Remou
Hi Remou,Thank you very much.I will try it..Thanks.
Suman
Thank you Remou, It works..in ve.net as well..Thank you again...
Suman