API Support Forum
OEC API > API Support > API 3.2 - C# 2008
Author Topic: API 3.2 - C# 2008
(5 messages, Page 1 of 1)
Moderators: VPfau
WBetts
Posts: 19
Joined: May 29, 2008


Posted: May 29, 2008 @ 03:26 PM             Msg. 1 of 5
I recently registered and downloaded the API files.
I imported the project into C# 2008.

When trying to preview the design view of a few of the forms I get the following error:


Object reference not set to an instance of an object.

at OEC.API.Example.OrderDraftControl.PrepareControlEventHandlers() in C:\_Accurate\OpenECry\OEC API Example\OrderDraftControl.cs:line 32
at OEC.API.Example.BaseControl..ctor() in C:\_Accurate\OpenECry\OEC API Example\BaseControl.cs:line 34
at OEC.API.Example.OrderDraftControl..ctor() in C:\_Accurate\OpenECry\OEC API Example\OrderDraftControl.cs:line 21



I can't find any issues with the code on those lines. The controls OrderDraftControl & BaseControl open fine by themselves.

Also, the application runs fine. I simply can't get to the form design view to modify the form objects.

Any helps is appreciate.

-TraderBetts
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: May 29, 2008 @ 03:38 PM             Msg. 2 of 5
please open file basecontrol.cs, and replace Line 31

if (IsDesignMode)

with

if (DesignMode)

then compile the project - that should help.
WBetts
Posts: 19
Joined: May 29, 2008


Posted: May 29, 2008 @ 03:53 PM             Msg. 3 of 5
Thanks VERY much for the quick response Serge.

that got rid of the error for basecontol.cs but I still get them for the other two lines.

OrderDraftControl.cs line 21 & 32.

Also, when I try to open MainForm I get errors on about 30 different lines / objects. I can send paste those errors if you want as well.

Are there these types of issues in every form? Is this a C# 2008 problem?

Thanks again,
TraderBetts
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: May 29, 2008 @ 03:56 PM             Msg. 4 of 5
actually, the change should prevent the PrepareControlEventHandlers method from execution in all classes.
Please try to rebuild the solution and then restart MSVS.

We do not work with VS2008, so I may only guess what the problem is.
WBetts
Posts: 19
Joined: May 29, 2008


Posted: May 29, 2008 @ 04:01 PM             Msg. 5 of 5
Thanks. I just commented out the PrepareControlEventHandlers for now and it opens fine. I'll track down the exact issue later.

Thanks again for the quick response.
-TraderBetts