Results 1 to 4 of 4

Thread: Correction of a code in vb.net

  1. #1
    Join Date
    Apr 2009
    Posts
    90

    Correction of a code in vb.net

    I have started programming in VB just 1 an half months before but for implementing program logic I still have a problem, here I have a class called book shelf and books and classes which is to be a module sub main.

    I have a box of execution during debugging which tells me: Object reference not set to an instance of an object.

    C code is as follows:
    class book

    Code:
    Public Class Book  
          Private _titre As String  
       
          Public Sub New ()  
    
          End Sub  
    
          Property title ()  
              Get  
                  Return _titre  
              End Get  
              Set (ByVal value)  
                  _titre = value  
              End Set  
          End Property  
      End Class
    Class shelf:

    Code:
     Public Class stager  
          Private t () As book a table books  
          As Integer Public nb  
          Dim j As Integer 'the number of books in the existing floor  
    
          Sub New ()  
    
          End Sub  
    
          Sub New (ByVal nombrlivre As Integer) 'the programmer chooses the number of books that may contain un stage  
              deliver = nb - 1  
              ReDim t (nb)  
              t (nb) = New Book  
          End Sub  
         
          Sub ajouter_livre (ByVal title As String)  
    
              If j <= nb Then we added provided that it not exceed the number of book that can hold the floor  
              T (j). Titr title = 'the program hangs here 
                  j = j + 1  
              Else  
                  Console.WriteLine ( "The floor is full")  
              End If  
          End Sub  
         
      End Class
    How do i test the above program using a module whether this written code is working fine.

  2. #2
    Join Date
    Jan 2009
    Posts
    140

    Re: Correction of a code in vb.net

    Hi,
    Could you put your code between the tags code # step? It would be easier for everyone.
    Maybe your problem is that t is not public, it is private.

    Code:
     Private t () As book a table books
    Hopefully this will help you.

  3. #3
    Join Date
    Jan 2009
    Posts
    143

    Re: Correction of a code in vb.net

    In the initialization of your shelf (new) assigning you a book that position 4:

    Code:
    Sunday stager1 As New shelf (4)
    Code:
     Sub New (ByVal nombrlivre As Integer) 'the programmer chooses the number of books that may contain un stage 
              deliver = nb - 1  
              ReDim t (nb)  
              t (nb) = New Book  
          End Sub
    here i have given some idea to you.

  4. #4
    Join Date
    Apr 2009
    Posts
    90

    Re: Correction of a code in vb.net

    yes, it is the solution I've found the right directly after sending my question and I have understood my fault it is that I have only the instantiated object table last case anyway thank you for your intervention.

Similar Threads

  1. HTC Titan- Auto correction.
    By !Shea! in forum Portable Devices
    Replies: 1
    Last Post: 20-11-2011, 06:16 AM
  2. Spelling Correction is not working properly on the iPad
    By Rupashri in forum Portable Devices
    Replies: 4
    Last Post: 23-12-2010, 04:30 PM
  3. VLC (VideoLAN) Gamma Correction for MPG Video File?
    By Bower in forum Windows Software
    Replies: 6
    Last Post: 05-05-2010, 09:22 AM
  4. Image correction problem in Photo
    By Eber in forum Windows Software
    Replies: 5
    Last Post: 19-01-2010, 02:00 AM
  5. Array correction
    By cyber-noob in forum Software Development
    Replies: 3
    Last Post: 27-11-2009, 02:07 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,713,935,044.11569 seconds with 16 queries