Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2012 Classes versus Structure

$
0
0
Hi,
I have a problem converting a class into a structure.

I have this module:

Code:

    Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
        Dim newCustomerForm As New frmAddCustomer
        newCustomerForm.ShowDialog()
        If newCustomerForm.Customer IsNot Nothing Then
            customers.Add(newCustomerForm.Customer)
            CustomerDB.SaveCustomers(customers)
            Me.FillCustomerListBox()
        Else
            MessageBox.Show("btnAdd Click not have data...", "Customer form error...")
        End If
    End Sub

And this line of Code: If newCustomerForm.Customer IsNot Nothing Then -- that draws an error on the IsNot Nothing
I think it should be checking for a Null, but can't get the syntax correct.

The reason is in the class it is instantiated as a reference, where as in the structure it is a value

Any help would be appreciated
Thanks in advance...

Viewing all articles
Browse latest Browse all 27554

Trending Articles