I have found here tons of examples to use this API function. However, I am still having trouble using it.

It works fine when placing the returned data in a TextBox but I need to place it in a String variable and I get funky characters after the useful data I am looking for...

Here is my code:

Code:
Public Function GetBarcode() As String
Dim lRetVal As Long
Dim sTemp As String * 50

m_strFullName = "c:\temp\MyFile.ini"
lRetVal = GetPrivateProfileString("Fiber Data", "ID", "", sTemp, Len(sTemp), m_strFullName)

If lRetVal = 0 Then
    GetBarcode = ""
Else
    GetBarcode = UCase(Trim(sTemp))
End If

End Function
Any ideas ? I'm lost...

Thanks !