Assembly and DataTable

  • Thread starter Thread starter Thomas S. Andersen
  • Start date Start date
T

Thomas S. Andersen

Hi

In a test project, I have a class derived from DataTable and I try to use it
in a Pocket application.

The class seems to work fine if it's in the same project as the application.
But if it's moved to it's own project, it doesn't.
What am I missing?

Best regards,
Thomas S. Andersen
 
If the two projects are in the same solution you can add a reference to your
datatable project from your consuming application by selecting Project > Add
Reference, then select the Projects tab from the dialog and select your data
table project. This will ensure that when the solution is built the dll will
be copied and reference from the calling application. Also make sure that in
your solution your application project (and not your data table project) is
set as the start-up project for debugging. Visual Studio displays the
start-up project with bold text in the Solution Explorer tree.

Peter
 
Thomas S. Andersen said:
Hi

In a test project, I have a class derived from DataTable and I try to use it
in a Pocket application.

The class seems to work fine if it's in the same project as the application.
But if it's moved to it's own project, it doesn't.
What am I missing?

Best regards,
Thomas S. Andersen

More:

The class is reduced to:

public class TestDataTable: System.Data.DataTable
{
public TestDataTable()
{
}
}
 
Peter Foot said:
If the two projects are in the same solution you can add a reference to your
datatable project from your consuming application by selecting Project > Add
Reference, then select the Projects tab from the dialog and select your data
table project. This will ensure that when the solution is built the dll will
be copied and reference from the calling application. Also make sure that in
your solution your application project (and not your data table project) is
set as the start-up project for debugging. Visual Studio displays the
start-up project with bold text in the Solution Explorer tree.

Peter


Thats not the problem.

The dll is referenced and destributed to the Pocket PC. But the application
just shuts down without any warnings.

By changing stuff, I can force it to give me a "MethodNotImplimented"
exeption, but thats it.


Best regards,
Thomas S. Andersen
 
Can you determine the exact line of code where this exception occurs? is it
the constructor?, do both libraries have a reference to System.Data etc

Peter
 
Peter Foot said:
Can you determine the exact line of code where this exception occurs? is it
the constructor?, do both libraries have a reference to System.Data etc

Peter

The problem is when the DataTable'ed class is contructed. I found out it's a
"System.TypeLoadException" (?)

Here's how to reproduce it (If somebody has the time to help):

1. Make a "Smart Device Application".
2. Add a "Class Library" project
3. Change Class1, so that it derives from "System.Data.DataTable"
4. Reference "ClassLibrary1" from "SmartDeviceApplication1"
5. Add "ClassLibrary1.Class1 class1 = new ClassLibrary1.Class1();" to
Form1's constructor

Run the app, and you get the exception??

If the DataTable-derived class is made in "SmartDeviceApplication1"-project
instead, it works perfectly????

(Yes they both reference "System.Data")


Best regards,
Thomas S. Andersen
 
Thomas,

Make sure DLL with class derived from DataTable is deployed to the device
to the same folder as the main project.
If not, your application won't be able to load this DLL and
TypeLoadException will be thrown.

If it's not deployed, add DLL to the project and send build action to
'Content'.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
Back
Top