VB2008 How to check for a Null Bitmap in an Array

Posted on 2009-04-23
Last Modified: 2013-11-27
I have an array of type bitmap and I want to check if an element is empty or not. Something like:

Dim FlagBitmap(8) As Bitmap
If FlagBitmap(RandomInteger) = DBNull.Value Then

But I keep getting an error because zero or null cannot be used with = with a bitmap. Can anyone help?
Question by:onewheelhk
    LVL 53

    Expert Comment

    Can you try this
    if FlagBitmap(RandomInteger) = Null
    LVL 46

    Accepted Solution

    If FlagBitmap(RandomInteger) Is Nothing Then

    LVL 2

    Expert Comment

    IsNothing: Example

    Public Sub test()
        Dim o As Bitmap

        If IsNothing(O) Then
        End If
    End Sub
    LVL 1

    Author Comment

    I tried

    If FlagBitmap(RandomInteger) = Null  

    Error says Null constant is no longer supported

    I've just tried

    If FlagBitmap(RandomInteger) Is Nothing

    and that seems to work. Excellent. Thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now