Results 1 to 3 of 3

Thread: [RESOLVED] C# to vb translation of != null

  1. #1

    Thread Starter
    Hyperactive Member Rocketdawg's Avatar
    Join Date
    Feb 2003
    Location
    Back in the doghouse
    Posts
    294

    Resolved [RESOLVED] C# to vb translation of != null

    Hi

    I'm trying to translate a bit of text:

    Code:
    if (connection_string_read_from_web.config != null) 
    (.....create a dataset.....)
    return null;
    This tests to see if there's a string in the variable (connection string) and if not, it returns null.

    How do I return 'null' in vb? Would I return DBNull.value?

  2. #2
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: C# to vb translation of != null

    Hi there,
    Code:
    If whateveryouaretesting IsNot Nothing Then
    ' Do something
    End If

  3. #3

    Thread Starter
    Hyperactive Member Rocketdawg's Avatar
    Join Date
    Feb 2003
    Location
    Back in the doghouse
    Posts
    294

    Re: C# to vb translation of != null

    nmadd

    A big thanks! Nothing is exactly what I needed.

    Changed the function to: return nothing

    Now the Gridview's EmptyDataText displays just fine if there's a problem in the Try Catch.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width