Below are two snippets of code. The first works, but the second is claiming that "Object reference not set to an instance of an object." As near as I can tell, they're effectively identical, so why does the second one not work? They're written in Visual Basic 2005, and are part of my final project for Intro to Programming. Sad thing is I showed the teacher and he wasn't sure what I did in the first one!
Dim picButton As System.Windows.Forms.PictureBox
Dim lstButton As System.Windows.Forms.ListBox
Do Until Placement > 26
If Placement < 9 Then
picButton = Me.Controls("picSkill0" & (Placement + 1))
lstButton = Me.Controls("lstSkill0" & (Placement + 1))
Else
picButton = Me.Controls("picSkill" & (Placement + 1))
lstButton = Me.Controls("lstSkill" & (Placement + 1))
End If
LoadButtonInfo(0, Placement, picButton, lstButton)
Placement += 1
Loop
Dim BoxRef As System.Windows.Forms.NumericUpDown
BoxRef = Me.Controls("numAccuracy")
AttributeChange(0, BoxRef)
Ideas? I'm at a total loss, and searching for hours on the web has yielded nothing relating to this except mention of using something like "Set Boxref =" etc. Problem is when I try to prefix that line with Set, Visual Basic discards it again.
My name is "Todd". Drop the "T" and it explains sooooooo much! :P