I've only used these things in Delphi, but it looks right to me.
The only concern I have is based upon your error message:
what kind of thing is OpenDialog1? Is it a pointer to a TOpenDialog? (And not an direct object or a reference?) Is it visible in the current scope where you are using it?
Hope this helps.