justin1552
Hurr Durr
Ok, I've been working on a code for VB2005 that will display book titles and I keep getting an error saying Value cannot be null. Paramater Name: item. I've tried multiple things and none seem to work. Here's my code so far. The line in bold is where I've had the problem. Any help would be appreciated.
'Name: Flick's Book Publishing
'Developer: JDT
'Date: 06/03/2010
Option Strict On
Public Class frmFlicksPublish
Public Shared _intSizeOfArray As Integer = 17
Public Shared _strInventoryItem(_intSizeOfArray) As String
Private _strItemId(_intSizeOfArray) As String
Private Sub frmFlicksPublish_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim objReader As IO.StreamReader
Dim strLocationAndNameOfFile As String = "J:\Class Information\Lafferty\VB\Chapter 09\warehouse.txt"
Dim intCount As Integer = 0
Dim intFill As Integer
Dim strFileError As String = "The file is not available. Restart when the file is available."
If IO.File.Exists(strLocationAndNameOfFile) = True Then
objReader = IO.File.OpenText(strLocationAndNameOfFile)
Do While objReader.Peek <> -1
_strInventoryItem(intCount) = objReader.ReadLine()
_strItemId(intCount) = objReader.ReadLine()
intCount = +1
Loop
objReader.Close()
For intFill = 0 To 16
Me.lstBooks.Items.Add(_strItemId(intFill))
Next
Else
MsgBox(strFileError, , "Error")
Me.Close()
End If
End Sub
Private Sub btnComputeInventory_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
End Sub
Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click
Application.Exit()
End Sub
Private Sub mnuClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuClear.Click
Me.lstBooks.Items.Clear()
End Sub
End Class
'Name: Flick's Book Publishing
'Developer: JDT
'Date: 06/03/2010
Option Strict On
Public Class frmFlicksPublish
Public Shared _intSizeOfArray As Integer = 17
Public Shared _strInventoryItem(_intSizeOfArray) As String
Private _strItemId(_intSizeOfArray) As String
Private Sub frmFlicksPublish_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim objReader As IO.StreamReader
Dim strLocationAndNameOfFile As String = "J:\Class Information\Lafferty\VB\Chapter 09\warehouse.txt"
Dim intCount As Integer = 0
Dim intFill As Integer
Dim strFileError As String = "The file is not available. Restart when the file is available."
If IO.File.Exists(strLocationAndNameOfFile) = True Then
objReader = IO.File.OpenText(strLocationAndNameOfFile)
Do While objReader.Peek <> -1
_strInventoryItem(intCount) = objReader.ReadLine()
_strItemId(intCount) = objReader.ReadLine()
intCount = +1
Loop
objReader.Close()
For intFill = 0 To 16
Me.lstBooks.Items.Add(_strItemId(intFill))
Next
Else
MsgBox(strFileError, , "Error")
Me.Close()
End If
End Sub
Private Sub btnComputeInventory_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
End Sub
Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click
Application.Exit()
End Sub
Private Sub mnuClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuClear.Click
Me.lstBooks.Items.Clear()
End Sub
End Class