SAP GUI Scripting with VB.NET
I try to write VB.NET application using SAP GUI Scripting classes. Two first lines of the code below attaches SAPLogOn to the script. It works OK. When I try to set object "connection" ( third line)I receive an error.
"An unhandled exception of type 'System.InvalidCastException' occurred.Specified cast is not valid"
SapGuiAuto = GetObject("SAPGUI")
application = SapGuiAuto.GetScriptingEngine
connection = application.Children
Maybe somebody knows how to write that code properly?
In VB6 there is no problem. Third line looks like:
connection = application.Children(0)