Every tick of timer I'd like to check the received data: "000000000" and if any of these bits are set to 1 then change picturebox. This part of code is working - but I think I have a memory leak problem (memory used by program is increasing drastically). How to resolve this problem?
private void RefreshingTimerTick(object sender, EventArgs e)
{
for (int i = 1; i < 9; i++)
{
if (ReceivedDataTextBox.Text[i - 1].ToString() == "1")
((PictureBox)this.tabPage1.Controls["pictureBox_DO" + i.ToString()]).Image = new Bitmap(@"Logos\\green.png");
else ((PictureBox)this.tabPage1.Controls["pictureBox_DO" + i.ToString()]).Image = new Bitmap(@"Logos\\red.png");
}
}