[Sloved] Unable to Convert from VB.net to Gambas Please help
Posted
#1
(In Topic #1193)
Enthusiast

Code (gambas)
- 'Get the Odd numbers
- TotalOdd = TotalOdd * 3
- 'Get the Even numbers
- Total = TotalOdd + TotalEven
I am getting a error on line Dim LocalBarcodeNumber As Integer = the error is "wanted sting got integer instead"
I though I had translated this right from VB.net but I must have missed something
Can some one spot where I have gone wrong as I have spent most of the day trying to figure out what I have done wrong.
If it works it should return a barcode number 10000007
Below is the VB Orginal code
Code (gambas)
Posted
Guru

In gambas it is a String function and can only be used on strings not integers.
you can use Str() and CInt() to convert to string and back to integer
Maybe something like this works…
Note: i did not use the second value of 1 for Right() as 1 is the default
Posted
Guru

Return Mod10CheckDigit = (Barcode & BarcodeLocal)
what's that about? you can't use the function name in the return value like that in gambas.
might be something more like this…
Return CInt(Str(Barcode & BarcodeLocal))
Posted
Enthusiast

returns a specified number of characters from the right side of a string.
Posted
Guru

Posted
Guru

Code (gambas)
- 'Get the Odd numbers
- TotalOdd = TotalOdd * 3
- 'Get the Even numbers
- Total = TotalOdd + TotalEven
Note: you may get overflow if the number is too large using Integer and Long might be better
Posted
Guru

Cogier who runs this site wrote 3 of them so i'm sure he will be great for any help you may need.
Posted
Enthusiast

BruceSteers said
Any way I have no idea what it is supposed to do but this code works and does somethingCode (gambas)
'Get the Odd numbers TotalOdd = TotalOdd * 3 'Get the Even numbers Total = TotalOdd + TotalEven
Note: you may get overflow if the number is too large using Integer and Long might be better
Thank you BruceSteers This worked perfectly
1 guest and 0 members have just viewed this.




