Convert.ToString

PHOTO EMBED

Thu Aug 31 2023 21:17:45 GMT+0000 (Coordinated Universal Time)

Saved by @Zohir

Do not use .ToString() it will cause null reference exception when the value is null. Use Convert.ToString(), it will return empty string for the null value.

col1 = Convert.ToString(row.Cells[i + 1, 1].Value2);
col2 = Convert.ToString(row.Cells[i + 1, 2].Value2);
content_copyCOPY