1.11M Members

Reading a cell value from excel

 
0
 

// ws is an object variable of worksheet
// systype is a string variable

Range r = (Range)ws.Cells[2, 2];
systype = r.Value2.ToString();

how can I combine these two lines into one single line ?
Please help ....

 
1
 

((Range)ws.Cells[2, 2]).Value2.ToString();


ToString() sometimes lead to null reference exception , try to avoid using it.

Question Self-Answered as of 2 Years Ago
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: