ddd
ddd

Reputation: 285

How to import two seperate excel files into the same data grid view

I am using data grid view in Vb.net and would like to load two excel files into it. My two excel files look like this:

file1:

id |first name| last name

3 | dan | kirk

1 | elvis | presley

4 | john | Malcovich

file2:

ssn | sex | age

123 | male| 39

345 | male| 55

523 | male| 23

The problem I want to solve is the following: I would like to map the values from the data set in file 2 to the sorted data set from file 1. So for example If I want to sort all the data by id# descending then (using the example from above) the data in datagrid view1 and in datagridview2 should be reversed.

Right now if I sort the column from file1 in datagrid view all the other columns in THIS datagridview1 are also sorted in relation to column2. What I want is that the columns in file2 will also sort according to file1.

Upvotes: 0

Views: 550

Answers (1)

Jim
Jim

Reputation: 624

I don't see how the 2 files relate to each other. Try adding another column to file2 with the id. Then you can relate them to each other. Sort one file, then sort the other according to other id order.

file2:

ssn | sex | age | id

123 | male| 39 | 3

345 | male| 55 | 1

523 | male| 23 | 4

Upvotes: 0

Related Questions