Hi,

I am debugging an application developed by another programmer. AxInterop OCW11 excel component is used. The following code is giving an error "Input string was not in a correct format", "object reference was not set to an instance of an object".

strTest = axSpreadsheetASCIIop.ActiveCell.get_Range(
(Convert.ToChar(Col1)).ToString() + longRow1.ToString(), (Convert.ToChar(Col1)).ToString() + longRow1.ToString()).Value2.ToString();

The above piece is within a loop, just before the exception I see that strTest= " ..." something like that and next time it causes exception at the above line.

Any inputs will be helpful.

BTW this is in a C# windows application.

Thanks,
mrk

Debug is your friend.

You need to find the parts it puts together eg:
Convert.ToChar(Col1)).ToString();
longRow1.ToString(), (Convert.ToChar(Col1)).ToString() ;
longRow1.ToString();

and then the overrall

axSpreadsheetASCIIop.ActiveCell.get_Range(
(Convert.ToChar(Col1)).ToString() + longRow1.ToString(), (Convert.ToChar(Col1)).ToString() + longRow1.ToString()).Value2

Thank you. I was able to resolve this. I had to use :
axSpreadsheetASCIIop.ActiveSheet.Cells.get_Range instead of
axSpreadsheetASCIIop.ActiveCell.get_Range.

Thanks,
mrk

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.