Click here to Skip to main content
15,911,785 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have an Excel file with name ABC

there are 4 column in the excel file

now i want to check that if colA have id 3 then copy that data and show in the Grid View

How can i perform this task


and i want to use upload control of dev express
and every time the file may be different

how can i perform this?


please help me

and sorry for my bad english
Posted

1 solution

My syntax may be off but I used to program with excel so it'll be close enough for you to google the true way.

Use the openfiledialog to allow different file names. You can also put a filter in this dialog to only allow excel documentation.

Make sure to attach Microsoft.Interop.Excel(whichever version you need)

then inside your form do something along the lines:
VB
#import interop.excel

public class myClass

private sub LoadFile

if openfiledialog.ok
dim newExcelFile as file = openfiledialog.path
newexcelfile.open
while newexcelfile.rows(idx).cells(0) is not nothing
if newexcelfile.rows(idx).cells(0) = 3
addtomyDataGrid(newexcelfile.rows(idx)) 
endif
idx += 1
end while
end if
end sub
end class
 
Share this answer
 
Comments
prince_rumeel 16-Oct-12 11:12am    
any other solution plz

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900