![]() |
Object reference error
I'm trying to make a parser for a text file, but I'm getting an object reference error. Can somebody tell me why?
:
Dim filereader As StringThe red line has error attached to it saying object reference not set to an instance of an object |
let me see if I can explain this right.
here's the problem, you attempt to put something in the array newword but you never allocated any space for that array. what i mean by this is, you never gave it bounds ex: newword(5) would allocate 5 indexes. what you can do is this... :
the reason you didn't have to set up the word array like this is because you are not trying to utilize its indexes until you set it equal to an existing array(which does have allocated memory) ex: :
|
Ahh, that makes a lot of sense, thanks melbolt. But now i'm gonna have to rethink my algorithm because the array will be different each time. Can you dynamically allocate a vector? I need to re-learn how to do a vector.
|
Here's what I wound up doing; it's not elegant, but it does the job.
:
Dim filereader As String |
| All times are GMT -5. The time now is 3:13 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC