TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
viva
NA
527
32.9k
how to pass variable value in event handler
May 15 2013 8:41 AM
Hi
I am beginner in C#.
In for loop , I am creating panel control with Image inside (calling 10 images),When I click on image , it should display value of that Image (Image number) using pop up message box. Please suggest code for the same
public Form1()
{
InitializeComponent();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
for (int count = 1; count < 11; count++)
{
this.panel1 = new System.Windows.Forms.Panel();
// panel1
this.panel1.BackgroundImage = Image.FromFile(Application.StartupPath + "\\activecell.jpg");
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panel1.Location = new System.Drawing.Point(50, 50);
this.panel1.Name = "panel1" + count;
this.panel1.Size = new System.Drawing.Size(70, 35);
this.panel1.Click += new System.EventHandler(this.panel1_Click);
this.flowLayoutPanel1.Controls.Add(this.panel1);
}
}
private void panel1_Click(object sender, EventArgs e)
{
}
as I can not pass count variable to panel1_Click variable and i want to display count value on message box.
please reply
regards
Viva
Reply
Answers (
8
)
Extract the class file from the dll in c#
Resizeable toolbar similar as Word 2003 through code