Hello, Im new to programming in general. Did a little on apple IIEs but that wasnt much. I have desiced to try to learn again with vb.net and ran into something. Im learning with the "Visual Basic .NET Step by Step" book.
When I try to add a value to a variable in a structure I get an error.
An unhandled exception of type System.NullReferenceException
Additional information: Object reference not set to an instance of an object.
Example: Trying to make a small address book.
This structure and the sub are in the module.
frmAdd is the form that information is added to the address book.
Didnt put in the rest of the sub because it was the same as the first few lines.
Anyway. When I type in the values in the text boxes and hit the button that calles this sub. I get the error described above. At the first line of the sub.
I think I need to back off coding for now, I have a headache.
I have done some tread searching but didnt come up with anything.
When I try to add a value to a variable in a structure I get an error.
An unhandled exception of type System.NullReferenceException
Additional information: Object reference not set to an instance of an object.
Example: Trying to make a small address book.
This structure and the sub are in the module.
frmAdd is the form that information is added to the address book.
Code:
Structure Person
Public firstName As String
Public middleName As String
Public lastName As String
Public homeNumber As String
Public email As String
Public address As String
Public city As String
Public state As String
Public workNumber As String
Public cellNumber As String
Public photo As Image
End Structure
Public page() As Person Array for number of people in book
Public pg As Short value to determine how many pages
Sub pageFill()
page(pg).firstName = frmAdd.txtFirstName.Text < error here
page(pg).middleName = frmAdd.txtMiddleName.Text
page(pg).lastName = frmAdd.txtLastName.Text
page(pg).homeNumber = frmAdd.txtHomeNumber.Text
end sub
Didnt put in the rest of the sub because it was the same as the first few lines.
Anyway. When I type in the values in the text boxes and hit the button that calles this sub. I get the error described above. At the first line of the sub.
I think I need to back off coding for now, I have a headache.
I have done some tread searching but didnt come up with anything.