Curse you DBNull and/or Is Nothing!

that's right, just a title... we do that here. We also have no logo, or branding or consistent income... However, we DO have a hatred for redundant logic.
    Function Notta(ByVal x As Object) As String
        Dim ret As String
        If (x Is DBNull.Value) OrElse (x Is Nothing) OrElse (x Is String.Empty) Then
            ret = ""
        Else
            Try
                ret = CStr(x).Trim
            Catch
                ret = ""
            End Try
        End If
        Return ret
    End Function

Comments


Comments Disabled For Now

 

 







LATEST POSTS

Viewstate bad developer, bad. Animation != Application Frame-based illiteration engulfs world. Developers worldwide cry. Handy ASP.NET Routines Bullshit Talks But money wont shut the hell up. PostBackUrl Equals Change the Friggin' Form Action .

ADS

MOST POPULAR

Multiple IEs in Windows Firefox Vs. The World Who Is Xperya? ActionScript Form Fields Quick Watermark IE 7 beta 2 standalone

IP Address Tool Chicago Web Design Free Text Messaging