I Hope someone can help me

I am trying to convert this code from Visual BASIC to Gambas

the code works out the check digit for a barcode number using Mod10CheckDigit (Based on https://www.freevbcode.com/ShowCode.asp?ID=1035)

Code: Select all

```
Dim i As Integer = 0
Dim TotalOdd As Integer = 0
Dim TotalEven As Integer = 0
Dim Total As Integer = 0
Barcode = Trim(Barcode)
'get odd numbers
For i = 1 To Len(Barcode) Step 2
TotalOdd = TotalOdd + CInt(Mid(Barcode, i, 1))
Next
TotalOdd = TotalOdd * 3
'get even numbers
i = 0
For i = 2 To Len(Barcode) Step 2
TotalEven = TotalEven + CInt(Mid(Barcode, i, 1))
Next
Total = TotalOdd + TotalEven
Dim BarcodeLocal As Integer = 10 - IIf(Right(Total, 1) = 0, 10, Right(Total, 1))
BarcodeNumberInHouse = Barcode & BarcodeLocal
```

Dim BarcodeLocal As Integer = 10 - IIf(Right(Total, 1) = 0, 10, Right(Total, 1))

Type Mismatch: wanted string, got integer instead in Global:274

I hope someone can advice me