Data Model > Frequently asked questions > How do I convert a string to a numeric for use as an index into an MDM collection in Visual Basic .Net?
 
How do I convert a string to a numeric for use as an index into an MDM collection in Visual Basic .Net?
For example, in Visual Basic and VBScript, I use the CLng function to convert a string to a Long for use as an index into the Document.Variables collection. However, this does not work in Visual Basic .Net. Why is this?
In Visual Basic .NET, you need to use the CInt function to convert the string to an Integer rather than using the CLng function to convert it to a Long as you would in Visual Basic or VBScript. For example:
MyDocument.(CInt(strIndex)).FullName
This is because in Visual Basic .NET, the Integer data type is a 32-bit integer and corresponds to the Long data type in Visual Basic.
See also
Frequently asked questions