Results 1 to 2 of 2

Thread: Visual Basic Null Reference

  1. #1
    Join Date
    Mar 2011
    Posts
    1

    Visual Basic Null Reference

    I'm pretty new to VB and I encountered the following error "NullReferenceException was unhandled" with this code:
    Code:
        Public Class User
            Public Forename As String
            Public Surname As String
            Public Username As String
            Public Password As String
        End Class
    And then later this to assign a value
    Code:
    Users(UserIndex).Forename = Console.ReadLine()
    Then I hit the error.
    This is in a console application on VB 2010, can anyone give me a hand here?

  2. #2
    Join Date
    May 2009
    Posts
    201

    Re: Visual Basic Null Reference

    Well the first thing here is that if you are not entering the data and running the method readline() then definitely it will give you the null reference exception error because the value is not entered and it is being forced to be read. Now what you have to do here is that use the writeline() method and try and enter the data and then see whether doing the same helps or not.

Similar Threads

  1. Visual Basic Error 400
    By Abejar in forum Software Development
    Replies: 2
    Last Post: 12-05-2009, 01:38 PM
  2. what are Visual Basic IDE?
    By Naresh Modi in forum Software Development
    Replies: 2
    Last Post: 06-03-2009, 09:49 AM
  3. Is GUI same like Visual Basic ?
    By Caesar in forum Software Development
    Replies: 2
    Last Post: 02-03-2009, 01:32 PM
  4. Visual Basic 2005 or Visual Basic 6
    By Aasha in forum Software Development
    Replies: 5
    Last Post: 15-01-2009, 06:56 PM
  5. Visual Basic on LAN
    By djbbenn in forum Software Development
    Replies: 2
    Last Post: 05-08-2008, 02:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,718,561,805.68503 seconds with 17 queries