SRL Archive - General

VB .net paint history 2d array help


g0tp0t

2010-05-28 14:09:26

I pasted the code into paste bin at http://pastebin.com/aWVms2ju, to try the code, create a new windows forms application in visual basic .net, make sure the form is named form1 and then replace the form1.vb with that code in paste bin


The goal is to make a history of what was painted onto the form. This is just a little piece of the program I am making and it is one of two major problems I am having :[.

The two dimensional array gives a null reference error if I don’t assign it that value where I declared it. Now it is saying the index is out of array bounds. I don’t understand this because it is a dynamically expanding array… or so I thought.

i luffs yeww

2010-05-28 16:45:19

I'm not sure if this would help, but maybe try a collection? I always liked them more. And I thought they were much easier for dynamic "arrays."

g0tp0t

2010-05-28 17:02:27

google says a dynamic array is a collection…?

i luffs yeww

2010-05-28 18:09:34

>_> You don't know what a collection is? http://articles.techrepublic.com.com/5100-10878_11-5800272.html <– First google link for "collection vb6"

g0tp0t

2010-05-28 20:46:32

i just searched collection. cuz i dont use vb6 -.-

i luffs yeww

2010-05-28 22:39:14

What do you use? :p

g0tp0t

2010-05-29 00:31:55

vb .net 2010 ultimate

i luffs yeww

2010-05-29 00:45:06

Collections are the same.

g0tp0t

2010-05-29 01:23:19

oh. lol. well google makes it sound like arrays are a kind of a colletion. so what is the difference?

i luffs yeww

2010-05-29 01:25:42

How they're used. Collections are easier, in my opinion. Coll.Add("wat") is all you need to do to add something to the collection, I think. Sorry, I don't like VB.

g0tp0t

2010-05-29 01:53:22

lol. im pretty sure u can do that with arrays in vb too :P. lol. ty though

i luffs yeww

2010-05-29 01:58:56

Just try a collection. None of these posts would've happened if you would've just tried it, and your problem would've most likely been solved.

And if a collection doesn't work, then I'm sure I can help you if I actually take a little time to explain it.

g0tp0t

2010-06-01 13:33:30

http://pastebin.com/R9gdx8LC

that is my sad attempt at using the collection but it isnt working. am i doing it wrong??