I would like to get the last value of a specific column but it is returning the whole column values.
below is my code:
LastSSN = row(1).ToString().Split(","c).Last()
Both methods are to be used outside of the for each since you are only extracting the last item in the column and donβt need to loop through everything.
You can use some vb to convert it when performing the math.
The number is a little long so you might use the Long type. CLng(LastSSN)+1 or Convert.ToLong(LastSSN)+1
(for Int32, itβs just CInt() or Convert.ToInt32())
Itβs also good practice to check your string to make sure itβs a number first.
For example.
If(IsNumeric(LastSSN), CLng(LastSSN), 0) + 1
(Assuming LastSSN is the string you extracted as the last ssn)