0

I'm trying to access a data column in a datatable to get its value but i keep getting the same error that the IC NUMBER column does not belong to this table! on this line

ic[j] = Form1.dt.Rows[i]["IC NUMBER"].ToString();

when i debug the application i can see the column is there :

enter image description here

and when i use this code :

ic[j] = Form1.dt.Rows[i][5].ToString();

it works fine but i need to use the columns name since there will be more or less column each and every time user import a new file. what is wrong with my code?

CodeMonkey
  • 2,511
  • 4
  • 27
  • 38

0 Answers0