Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC8.0 C# Excel
Hi ,
 
I am developing an application in vc++ and C# . My Application can import from an excel file (2003,2007 & 2010 ) , for communicating with excel I am using Interop Assemblies . I am able to Import from excel and I am able to transfer to Excel . My Problem is when the user is changing the value in my application and when he is exporting it back to sample excel file instead of adding as a new record it should update the row from where it was imported .
 
For Example :
 
I am having a Excel File name "test.xls" which has 100 rows of data and this Excel file is imported to my application . User is updating the values in 10th Row and exporting back to same test.xls . At present this 10th row data will added as new row ie 101 , what I am expecting is instead of adding as new row, it Should modify or update the row 10 is this possible .
 
Can some one give me sample codes to do this .
 
Programming environment
 
Front End : vc++ mfc
 
Back end for Communicating with Excel : C#
 
Thanks
 
Subbu
Posted 8-Mar-11 22:39pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If you are using Datagridview to insert , display and update rows means,
Get the datagridview updated row number and Add 1 . Update the particular row in Excel
 
int Datagridviewupdatedrow = DataGridViewRowUpdated + 1 
 
 WorkSheetApp.Cells[Datagridviewupdatedrow, 1] = cell_value_1;
 WorkSheetApp.Cells[Datagridviewupdatedrow, 2] = cell_value_2;
 WorkSheetApp.Cells[Datagridviewupdatedrow, 3] = cell_value_3;
 
If you give a part of code , then will be helpful to explain more.
 
Thanks
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,569
1 Sergey Alexandrovich Kryukov 6,168
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 9 Mar 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100