Passing reference to a Winform into DLL

C

Charlie@CBFC

Hi:

My project has a seperate DLL for biz logic and an EXE for client app. I
would like to pass in a reference to a form in client app to DLL to capture
form element data for updating. In my DLL I have a reference to WinForms so
I can accept a form as a parameter. However, I must cast the form argument
to the appropriate form so I can access it members, but I can't reference an
EXE in DLL. How do I do this?

Thanks,
Charlie
 
A

Alan Pretre

Charlie@CBFC said:
My project has a seperate DLL for biz logic and an EXE for client app. I
would like to pass in a reference to a form in client app to DLL to
capture
form element data for updating. In my DLL I have a reference to WinForms
so
I can accept a form as a parameter. However, I must cast the form
argument
to the appropriate form so I can access it members, but I can't reference
an
EXE in DLL. How do I do this?

Hi. Create an interface, have the form implement the interface, then pass
the interface instance to the DLL. You can define the interface in the DLL
so that both have access to its definition.

-- Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top