Alper

Alper

  • NA
  • 3
  • 0

Visual C#.Net EventHandler Problem

Apr 21 2007 11:00 AM
Hi,i want to use pictureboxes in different eventhandler. Here are my codes:

private void buttonclick(object sender,EventArgs e) {
int i;
Form newform=new Form(); //creating form2
for (i=0;i<7;i++) { // loop that creates 6 picturebox
Picturebox newpicturebox=new picturebox(); //creating picturebox
newpicturebox.Name="picturebox"+i; //defining name
form2.controls.add(newpicturebox); //adding controls in form2
}
Timer newtimer=new Timer(); //creating timer to conrol pictureboxes that i defined in for loop
newtimer.interval=1000; //setting timer interval
newtimer.Tick+=new EventHandler(newtimer_Tick);//seting Timer's Eventhander

I want to control pictureboxes that i defined in for loop via newtimer_tick. How can i do this?

Answers (2)