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
Arun Kurmi
NA
104
103.8k
Foreach loop in C#
Mar 6 2013 5:24 AM
hi friends,
I want to understand following code line by line.........
private void button1_Click(object sender, EventArgs e)
{
label2.Text = "";
label3.Text = "";
foreach (object checkeditem in checkedListBox1.Items)
//why we cannot use instead of above line : foreach(
CheckedListBox
checkeditem in checkedListBox1.Items
)
{
string str = checkedListBox1.GetItemCheckState(checkedListBox1.Items.IndexOf(checkeditem)).ToString();
//meaning of this line
if (str == "Checked")
//why we used "Checked" .
{
label2.Text = label2.Text + checkeditem.ToString() + "\n";
}
else
{
label3.Text = label3.Text + checkeditem.ToString() + "\n";
}
}
thanks....
Reply
Answers (
5
)
how to find web cam details through C# button click event
Mailing Excel worksheet as an attachment without saving C#