I am getting this error (below) and do not understand how or why.
Perhaps part of the problem is that I am not experienced in OO
programming.
" An unhandled exception of type 'System.NullReferenceException'
occurred in GraphPlay2.exe
Additional information: Object reference not set to an instance of an
object."
This occurs in a very short Sub at the statement indicated ...
Private Sub ReadData()
Dim sInFileName As String = "allfiles.csv"
Dim srInFile As System.IO.StreamReader
Dim DebugTBLines() As String 'for setting TextBox Lines
srInFile = System.IO.File.OpenText(sInFileName)
Do
sInBuf = srInFile.ReadLine()
'MessageBox.Show("Record is """ & sInBuf & """")
If sInBuf Is Nothing Then Exit Do
RecordNumber += 1
If RecordNumber >= MaxFiles Then
MessageBox.Show("Too Damn Many Files; Giving Up")
Close()
Else : ParseInput()
DebugTBLines(RecordNumber) =
FileInfo(RecordNumber).Name '<<<< Error Happens Here !!!
End If
Loop
srInFile.Close()
TextBox1.Lines = DebugTBLines
End Sub 'ReadData
The Watch Window proves that RecordNumber has a value, 0, and that
FileInfo(0).Name has a value.
I'll appreciate any help/adivce/pointers you can offer.
Thanks, Bob 3 1126
Bob, Dim DebugTBLines() As String 'for setting TextBox Lines
DebugTBLines is nothing, you need to define a size for the array.
I would probably simply initialize it to MaxFiles, as that seems to be your
limit.
Dim DebugTBLines(MaxFiles) As String 'for setting TextBox Lines
This allows DebugTBLines to have MaxFiles + 1 entries as MaxFiles is the
upper bound of the array, with the lower bound being 0.
Hope this helps
Jay
"eBob.com" <eB******@totallyfakeisp.com> wrote in message
news:06********************************@4ax.com...I am getting this error (below) and do not understand how or why. Perhaps part of the problem is that I am not experienced in OO programming.
" An unhandled exception of type 'System.NullReferenceException' occurred in GraphPlay2.exe
Additional information: Object reference not set to an instance of an object."
This occurs in a very short Sub at the statement indicated ...
Private Sub ReadData()
Dim sInFileName As String = "allfiles.csv" Dim srInFile As System.IO.StreamReader Dim DebugTBLines() As String 'for setting TextBox Lines srInFile = System.IO.File.OpenText(sInFileName)
Do sInBuf = srInFile.ReadLine() 'MessageBox.Show("Record is """ & sInBuf & """") If sInBuf Is Nothing Then Exit Do RecordNumber += 1 If RecordNumber >= MaxFiles Then MessageBox.Show("Too Damn Many Files; Giving Up") Close() Else : ParseInput() DebugTBLines(RecordNumber) = FileInfo(RecordNumber).Name '<<<< Error Happens Here !!! End If
Loop srInFile.Close() TextBox1.Lines = DebugTBLines End Sub 'ReadData
The Watch Window proves that RecordNumber has a value, 0, and that FileInfo(0).Name has a value.
I'll appreciate any help/adivce/pointers you can offer.
Thanks, Bob
Jeez, what a dumb question. Sorry for asking it. Thanks for your
help Jay.
Bob
On Wed, 6 Oct 2004 11:46:27 -0500, "Jay B. Harlow [MVP - Outlook]"
<Ja************@msn.com> wrote: Bob, Dim DebugTBLines() As String 'for setting TextBox Lines DebugTBLines is nothing, you need to define a size for the array.
I would probably simply initialize it to MaxFiles, as that seems to be your limit.
Dim DebugTBLines(MaxFiles) As String 'for setting TextBox Lines
This allows DebugTBLines to have MaxFiles + 1 entries as MaxFiles is the upper bound of the array, with the lower bound being 0.
Hope this helps Jay
"eBob.com" <eB******@totallyfakeisp.com> wrote in message news:06********************************@4ax.com.. .I am getting this error (below) and do not understand how or why. Perhaps part of the problem is that I am not experienced in OO programming.
" An unhandled exception of type 'System.NullReferenceException' occurred in GraphPlay2.exe
Additional information: Object reference not set to an instance of an object."
This occurs in a very short Sub at the statement indicated ...
Private Sub ReadData()
Dim sInFileName As String = "allfiles.csv" Dim srInFile As System.IO.StreamReader Dim DebugTBLines() As String 'for setting TextBox Lines srInFile = System.IO.File.OpenText(sInFileName)
Do sInBuf = srInFile.ReadLine() 'MessageBox.Show("Record is """ & sInBuf & """") If sInBuf Is Nothing Then Exit Do RecordNumber += 1 If RecordNumber >= MaxFiles Then MessageBox.Show("Too Damn Many Files; Giving Up") Close() Else : ParseInput() DebugTBLines(RecordNumber) = FileInfo(RecordNumber).Name '<<<< Error Happens Here !!! End If
Loop srInFile.Close() TextBox1.Lines = DebugTBLines End Sub 'ReadData
The Watch Window proves that RecordNumber has a value, 0, and that FileInfo(0).Name has a value.
I'll appreciate any help/adivce/pointers you can offer.
Thanks, Bob
Bob,
I don't consider it a dumb question, as most or all of us do it once or
twice & miss the fact we did...
Just a thought
Jay
"eBob.com" <eB******@totallyfakeisp.com> wrote in message
news:ie********************************@4ax.com... Jeez, what a dumb question. Sorry for asking it. Thanks for your help Jay.
Bob
On Wed, 6 Oct 2004 11:46:27 -0500, "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote:
Bob, Dim DebugTBLines() As String 'for setting TextBox Lines DebugTBLines is nothing, you need to define a size for the array.
I would probably simply initialize it to MaxFiles, as that seems to be your limit.
Dim DebugTBLines(MaxFiles) As String 'for setting TextBox Lines
This allows DebugTBLines to have MaxFiles + 1 entries as MaxFiles is the upper bound of the array, with the lower bound being 0.
Hope this helps Jay
"eBob.com" <eB******@totallyfakeisp.com> wrote in message news:06********************************@4ax.com. ..I am getting this error (below) and do not understand how or why. Perhaps part of the problem is that I am not experienced in OO programming.
" An unhandled exception of type 'System.NullReferenceException' occurred in GraphPlay2.exe
Additional information: Object reference not set to an instance of an object."
This occurs in a very short Sub at the statement indicated ...
Private Sub ReadData()
Dim sInFileName As String = "allfiles.csv" Dim srInFile As System.IO.StreamReader Dim DebugTBLines() As String 'for setting TextBox Lines srInFile = System.IO.File.OpenText(sInFileName)
Do sInBuf = srInFile.ReadLine() 'MessageBox.Show("Record is """ & sInBuf & """") If sInBuf Is Nothing Then Exit Do RecordNumber += 1 If RecordNumber >= MaxFiles Then MessageBox.Show("Too Damn Many Files; Giving Up") Close() Else : ParseInput() DebugTBLines(RecordNumber) = FileInfo(RecordNumber).Name '<<<< Error Happens Here !!! End If
Loop srInFile.Close() TextBox1.Lines = DebugTBLines End Sub 'ReadData
The Watch Window proves that RecordNumber has a value, 0, and that FileInfo(0).Name has a value.
I'll appreciate any help/adivce/pointers you can offer.
Thanks, Bob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Daniel |
last post by:
Hello =)
I have an object which contains a method that should execute every x ms. I
can use setInterval inside the object construct like this -
self.setInterval('ObjectName.methodName()',...
|
by: Martin |
last post by:
I'd like to be able to get the name of an object instance from within
a call to a method of that same object. Is this at all possible?
The example below works by passing in the name of the object...
|
by: Carlos Lozano |
last post by:
Hi,
What is the right way to create an OCX COM component. The component is
already registerred, but can't create an instance. I am using the reference
to the interop module created.
If I use...
|
by: Adam |
last post by:
We have a web site that uses .vb for the web pages and .cs for a class
module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does
work with .NET 1.1.
When trying to access a page...
|
by: Luke Matuszewski |
last post by:
Here are some questions that i am interested about and wanted to here
an explanation/discussion:
1. (general) Is the objectness in JavaScript was supported from the
very first version of it (in...
| |
by: Andrew Poulos |
last post by:
With the following code I can't understand why this.num keeps
incrementing each time I create a new instance of Foo. For each instance
I'm expecting this.num to alert as 1 but keeps incrementing.
...
|
by: Shailen Sukul |
last post by:
Observed a weird behaviour with object references.
See code listing below:
using System;
using System.Collections.Generic;
using System.Text;
namespace PointerExceptionTest
{
/*
|
by: Philipp Reif |
last post by:
Hi all,
I've got a little hole in my head concerning references. Here's what
I'm trying to do: I'm calling a function, passing the reference of a
business object for editing. The function clones...
|
by: User1014 |
last post by:
A global variable is really just a property of the "Global Object", so
what does that make a function defined in the global context? A method
of the Global Object?
...
|
by: Ralph |
last post by:
Hi
I don't understand why it's not working:
function schedule(imTop){
this.tdImagesTop = imTop;
}
schedule.prototype.selectEl = function() {
alert(this.tdImagesTop);
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |