// 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 ....
// 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 ....
((Range)ws.Cells[2, 2]).Value2.ToString();
ToString() sometimes lead to null reference exception , try to avoid using it.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.