Public member 'length' on type 'DBNull' not found.

  • Thread starter Thread starter dave
  • Start date Start date
D

dave

..

Line 38: Function FormatURL5(ByVal strArgument) As String
Line 39: If strArgument.length > 0 Then
Line 40: Return ("<INPUT id='mmmm' type='checkbox' value='"
& strArgument & "' onclick='parent.runThis('" & strArgument & "')'>")
Line 41: End If
 
Hello,

you are probably trying to pass a DBNull to the function (it accepts an
Object type because you have not specified the type for the parameter). You
would need to check the value for DBNull before trying to use it like a
string. For example using some kind of helper function:

Public Function StringNullHelper(obj As Object) As String
If IsDbNull(obj) Then Return String.Empty
Return obj.ToString()
End Function

If the argument passed to this method equals to DBNull.Value, it returns
String.Empty.
 
Back
Top