Unable to cast object of type 'System.Byte[]' to type 'System.IConvertible'.
- by alvn.dsza
i get the error in following code
Function ReadFile(ByVal sPath As String) As Byte
Dim data As Byte
data = Nothing
Dim fInfo As FileInfo
fInfo = New FileInfo(sPath)
Dim numBytes As Long
numBytes = fInfo.Length
Dim fStream As FileStream
fStream = New FileStream(sPath, FileMode.Open, FileAccess.Read)
Dim br As BinaryReader
br = New BinaryReader(fStream)
data = Convert.ToByte(br.ReadBytes(numBytes)) `getting error on this line`
Return data
End Function