Hello Sebastian,
Old code (simplistic):
Imports Access = Microsoft.Office.Interop.Access
but doesn't work for
Imports Access = NetOffice.AccessApi (unable to cast in line lst.Add(ctl))
This is a very minor problem and allows me to get rid of the old roughness )
'ctl.Parent' threw an exception of type 'System.Runtime.InteropServices.COMException'
For other controls (ListBox, TextBox ...) this exception does not occurs.
Regards,
Serge
TextBox : _Textbox : IAccessibleOk, I agree with you. There is some strange, which I can't understand.
Old code (simplistic):
Sub Test(section as Access.Section)
Dim lst As New List(Of Access.Control)
Dim ctls = section.Controls
For i = 0 To ctls.Count - 1
Dim ctl = ctls(i)
lst.Add(ctl)
Next
End Sub
This code works for Imports Access = Microsoft.Office.Interop.Access
but doesn't work for
Imports Access = NetOffice.AccessApi (unable to cast in line lst.Add(ctl))
This is a very minor problem and allows me to get rid of the old roughness )
Can you say which property throw the COMException ? (.Parent or .Parent.Name).Parent
'ctl.Parent' threw an exception of type 'System.Runtime.InteropServices.COMException'
Data: {System.Collections.ListDictionaryInternal}
ErrorCode: -2146793279
HResult: -2146793279
HelpLink: Nothing
InnerException: Nothing
Message: "Исключение из HRESULT: 0x800A88C1"
Source: "Microsoft.VisualBasic"
StackTrace: " в Microsoft.VisualBasic.CompilerServices.Symbols.Container.InvokeMethod(Method TargetProcedure, Object[] Arguments, Boolean[] CopyBack, BindingFlags Flags)" & vbCrLf & " в Microsoft.VisualBasic.CompilerServices.NewLateBinding.CallMethod(Container BaseReference, String MethodName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, BindingFlags InvocationFlags, Boolean ReportErrors, ResolutionFailure& Failure)" & vbCrLf & " в Microsoft.VisualBasic.CompilerServices.NewLateBinding.ObjectLateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)" & vbCrLf & " в Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)"
TargetSite: {Void GetContainingTypeLib(System.Runtime.InteropServices.ComTypes.ITypeLib ByRef, Int32 ByRef)}
In my test this exception occurs for ComboBox and TabControl. For other controls (ListBox, TextBox ...) this exception does not occurs.
Regards,
Serge