private void radar_Tick(object sender, EventArgs e)
{
for (int i = 0; i < 20; i++)
{
x[i] = Readi(0x5C850C + (0x5A4 * i));
y[i] = Readi(0x5C8510 + (0x5A4 * i));
players[i].Location = new Point(x[i], y[i]);
}
}
and yeah, before that:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int []x=new int[32];int []y=new int[32];
PictureBox[] players=new PictureBox[32];
...
}
private void Form1_Load(object sender, EventArgs e)
{
int i = 0;
foreach (var ctrl in this.Controls)
{
if (ctrl is PictureBox)
{
var myPicturebBox = (PictureBox)ctrl;
players[i] = myPicturebBox;
this.Controls.Add(players[i]);
i++;
}
}
radar.Interval = 100;
radar.Start();
}
What I keep getting is "Object reference not set to an instance of an object". I don't want to make new object on every timer tick, I just want to change i-th picturebox's location. Any ideas?
Nulls are not x and y,null is pictebox array.(I tried adding players[i]=new PictureBox();
and it worked.That's how I know)