How to plus value to the cell


I have DataTableRow in this format: USA, New York, Mark, 100USD

And I need to add it to another DT, but I have to check if country(row(0)), city(row(2)), name(row(3)) match up, then I need to plus the amount and not create a new line.

Please give me advice how to do it.

Hi @Olek1

If the names of three columes are “counrty”, “city”, and “name”.

selectStr = “country=’”+DataTableRow(0).ToString + “’ and city=’”+DataTableRow(1)+"’ and name=’"+DataTableRow(2)+"’"

If DT.Select(selectStr).Count = 1
DT.Select(selectStr)(0)(3) = DT.Select(selectStr)(0)(3) + DataTableRow(3)

Before plus the money, maybe you need to use substring and CDbl Method to change the string of money into a Double value like below.
amount = amount + CDbl(“100USD”.Substring(0,“100USD”.Length-3))

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