Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42482

vs2010, Button(1) - Button(2500) "Addhandlers" too much for memory, how to reduce?

$
0
0
To explain further, i'm creating lots of buttons and want to be able to have each perform different actions.

R = 1
C = 1
For i as Integer = 1 to 2500
Button(R, C) = New Button
Button(R, C).Parent = Me
...
If C = 50 Then
R += 1
C = 1
Else
C += 1
End If
next

This is creating a grid of buttons from (1,1) to (50,50), and i want each button to change R and C to it's own number, ie

Addhandler Button(30, 48).Click, Addressof R30C48

Private Sub R30C48
R = 30
C = 48
End Sub

etc etc...

I made a seperate bit of software to write it all for me, but when i click one of the buttons it comes up with an error message saying that i'm using too much memory. I can only assume that there is a lesser memory consuming method of doing the same thing but in a much easier way, kind of like the For Loop i used to create the buttons.

Thank you in advance.

Viewing all articles
Browse latest Browse all 42482

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>