Doc or Doc.Forms is nil.Why am I getting this error?
WebForm := Doc.Forms.Item(0,'') as IHTMLFormElement; // "Object reference is nil" error occurs here
How can I fix this?check which one is nil and find out why. My guess would be there are no forms in the html you downloaded.
That would be even more confusing (and wrong)."something like" indeed. Feel free to explain classes and interfaces to the OP Thaddy. :D
I suppose you mean something like:
Var Doc: IHTMLDocument2; begin doc :=THTMLDocument2.Create as IHtmlDocument;// etc ---
Var Doc: IHTMLDocument2; begin doc :=IHTMLDocument2.Create as IHtmlDocument;
The recommended code returns the following compilation error message:
Error: identifier idents no member "Create"
There is no "Create" member for the class.
I cannot attach the source files since the zipped file size is around 350k.
"something like" indeed. Feel free to explain classes and interfaces to the OP Thaddy. :D
Var Doc: IHTMLDocument2; begin doc :=IHTMLDocument2.Create as IHtmlDocument;
The recommended code returns the following compilation error message:
Error: identifier idents no member "Create"
There is no "Create" member for the class.
I cannot attach the source files since the zipped file size is around 350k.
Are you blind? is says THTMLDocument2.Create as IHtmlDocument; not IHTMLDocument2.Create as IHtmlDocument;.... <sigh>
You can't call create an interface, you can call create on a class and assign it with "as IHtmlDocument" to interface variable.
https://github.com/facido/Demo/raw/master/Demo.zipAs said before, Doc is nil. You just do not wait for the page to load, and immediately rush to use it. I suspect that many other necessary properties are not established. I propose to look for a ready-made working example before doing it yourself. Or refer to the documentation.