It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Pls help! (nullreferenceexception was unhandled)

Moderator: dafunkymunky

Pls help! (nullreferenceexception was unhandled)

Postby trenmost on Sun Aug 17, 2008 3:37 pm

Hi i've started to learn VB.net (after years of VB6), but i've got a problem.

I created a structure, with variables and controls (checkboxes, textboxes, etc.)

The declaration looks like this:
Code: Select all
Structure Cvar

        Public a_name As String
        Public a_value As Integer

        Public frame As GroupBox

        Public combobox As ComboBox

        Public checkbox1 As CheckBox
        Public checkbox2 As CheckBox

End Structure



The problem is when i want to use them (

Code: Select all
cvar(count).frame.Left = cur_X


) i get an error message:

nullreferenceexception was unhandled

The help says i should use the following method:

Code: Select all
Public checkbox2 As New CheckBox



but the i get another error message:

Non-shared members in a Structure cannot be declared 'New'.


Thanks for any help :)
trenmost
 
Posts: 0
Joined: Sun Aug 17, 2008 3:35 pm

Who is online

Users browsing this forum: No registered users and 3 guests