Be Right Back, Uninstalling

Full Version: Visual basic is shit and you guys need to fix this for me:= Fixed=
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
lblFirstName.Text = NewPrisoner(i).strFirstName

is returning the old "Object reference not set to an instance of an object."

but i is an integer and NewPrisoner() is obviously an object

I thought maybe it wanted me to assign a value to NewPrisoner(0) as the function (the form loading) is called, so I set NewPrisoner(0).strFirstName to "Example" and I still got the error.

I then set i to 0 just to see if that changed anything, but still no.
I'm presuming when it said object reference it means the sub (), but it should be able to base the sub on the variable "i" even if "i" has not been assigned a variable? and to check it wasn't this I had set "i" to 0...

Mind fuck.

Someone with a formal education please explain what I'm obviously missing.

Thanks.
http://visualbasic.about.com/b/2008/10/1...object.htm
Those are the causes of that error and it sounds like your not initializing your variables.
(03-13-2011, 11:50 PM)negate link Wrote: [ -> ]http://visualbasic.about.com/b/2008/10/1...object.htm
Those are the causes of that error and it sounds like your not initializing your variables.

If that's true why did I get the same error when I assigned a value to NewPrisoner(0).strFirstName before?


-edit-
Proof read, when I declared NewPrisoner(i) as an array I wrote it as NewPrisoner()

Visual Basic was making shit up.
Why the fuck are they teaching you Visual Basic at Uni?
(03-14-2011, 09:52 AM)Eschatos link Wrote: [ -> ]Why the fuck are they teaching you Visual Basic at Uni?

I was taught it, and I do use it at work for some excel stuff.

VB and Java are decent starting platforms for general programing before you get deeper into something like C. Its technically not "real" programing, but it can teach you the basics of proper coding
(03-14-2011, 11:13 AM)Caffeine link Wrote: [ -> ][quote author=Eschatos link=topic=5512.msg199343#msg199343 date=1300114346]
Why the fuck are they teaching you Visual Basic at Uni?

I was taught it, and I do use it at work for some excel stuff.

VB and Java are decent starting platforms for general programing before you get deeper into something like C. Its technically not "real" programing, but it can teach you the basics of proper coding
[/quote]

I'd say I agree, but I've been teaching myself C++ and so far it's 90% as easy as Java. 
i learned vbs in server class for automating windows server tasks that should be automated already but windows is retarded