Comparing if two datatables are the same

GornHorse

Member
Joined
Jun 8, 2004
Messages
5
Programming Experience
5-10
Hi There,

I have two forms, each with a public datatable declared in them. To spare you the details of why, I want to know how I can compare the two datatables to see if they are equal.

I need to know that all data in each datatable is exactly the same. I have tried the following, but to now avail:
VB.NET:
if form1.datatable.tostring = form2.datatable.tostring then
the problem with this is that it is true for all datatables, even when they are not the same.
and...
VB.NET:
if form1.datatable.select is form2.datatable.select then
but this is false for all datatables, even when they are the same.

How can I successfully compare two datables to define whether they are equal or not?

I can't use:
VB.NET:
if form1.datatable = form2.datatable then
because it says that you can't compare reference types in this way, and, I can't use:
VB.NET:
if form1.datatable is form2.datatable then
because it is false for every datatable even when they are the same.


Please response asap, your help with this will be much appreciated!


Thanks,
Michelle
 

Latest posts

Back
Top