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
rao kalyani
NA
1
0
Error:Make sure that maximum index on a list is less than the list size
Jan 11 2009 6:33 PM
Hi ,
I created a methode to Add buttons and I called in Page_Load().But I wan to display which i button clicked on a Label
This is code...
public void AddButton(Button b1)
{
string s;
Panel p = new Panel();
Button[] b = new Button[10];
for (int i = 0; i < b.Length; i++)
{
s = i.ToString();
b[i] = new Button();
b[i].Text = Convert.ToString(i);
p.Controls.Add(b[i]);
b[i].Click += new EventHandler(Btn1_Click);
}
}
Its adding buttons to Panel.
Button Click
public void Btn1_Click(object obj, EventArgs ergs)
{
Label1.Text = b[i].Text;
}
When I am running this application I am getting Error
Make sure that maximum index on a list is less than the list size
.
Please tell me where I am doing wrong
Thanks
Kalyani
Reply
Answers (
1
)
Reading integer values from a textbox in visual C# 2008
Drawing text on a panel that scrolls