Adding data to a particular column of the datatable

I Have created build in Data table and added two column in the table as SrNo and Address

I have extract data from webpage added 100 data in SrNo column with help add row activity stored in data table

Now i want add some other data in same data table in beginning of Address column (B0)

SrNo Address
0) 1

  1. 2
  2. 3
    and so on…

Want add new data in Address column from the beginning of the table (in the 0 index of the column )

How can i add data in Address column



You can either for example put “Hello” in the first row like:
Assign [myDataTable.Rows(0).Item(“Address”) = “Hello”]

or with a For Each Row add it dynamically

Hi TastyToast,

I assigned in my data table value in a variable and pushing data one by one with the help increment counter I have read excel sheet it contains 1893 rows

Getting Errors AS: " There is no row at position 1892"


kindly help to resolve the issue


Do you get yourDatatable.Rows.Count.ToString as 1892? Then your DT is that long and you have no more rows.
rowIndex starts at 0
Datatable with 3 rows (index 0,1,2)
Datatable.Rows.Count : 3

So to check all rows you have to : rowindex < (Datatable.Rows.Count - 1)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.