long story short I have written a comparison for excel iterationh through rows in C# :
if(ws.Cells[i, "C"].ToString() == TextBox12.Text)
which turns out to be throwing an com hresult exception. What is the right way to do this comparison? I’ve done extensive searches on the internet but nothing that suits me.
Help needed!
Taking the
.ToString()method of thews.Cells[i,"C"]object returns the typeSystem._ComObject. You wantws.Cells[i,"C"].Value.ToString(). I tested it, and it found the two were equal.