I am having dificulties taking a datagrid cell value stored in the following location (datagridVNTPSorted.Item(15), irow).Value) into individual digits to reassign values for counters.

The cell in the datagrid (Listed Above) contains a number between 1 and 5624. I have 4 different counters. If the number was "2856", the counters would need to be updated as follows:

intdirectoryCountDigit1 = 2
intdirectoryCountDigit2 = 8
intdirectoryCountDigit3 = 5
intdirectoryCountDigit4 = 6

If the number in datagridVNTPSorted.Item(15), irow).Value was = "24" then the values would be as follows:

intdirectoryCountDigit1 = 0
intdirectoryCountDigit2 = 0
intdirectoryCountDigit3 = 2
intdirectoryCountDigit4 = 4

I attemped to use the Left and Right functions to return digits, but I keep on getting error messages. For Example: If the number of digits is 4, I attempted to get the correct values by doing the following:

intDirectoryCountDigit1 = Int(Left(datagridVNTPSorted.Item(15, iRow), 1))

intDirectoryCountDigit2 = Int(Right(Left(datagridVNTPSorted.Item(15, iRow), 2), 1))

intDirectoryCountDigit3 = Int(Right(Left(datagridVNTPSorted.Item(15, iRow), 3), 1))

intDirectoryCountDigit4 = Int(Right(datagridVNTPSorted.Item(15, iRow), 1))

If the total number of digits was three, the first digit would always be 0

If the total Number of Digits was 2, intDirectoryCountDigit 1 & 2 would always be 0

and so on... but I get error messages.

Any help is appreciated. Thanks