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

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
 
T

Teemu Keiski

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top