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
Mohammad Mirzaie
NA
2
646
Collection Was Modified; Enumeration Operation May Not Execu
May 22 2020 1:49 PM
Hello everyone,
I am new in VB.net, I have a treeview which first level node is populated with years. I have written some code which should read each node from tree view and add its months from datatabe under the year. I have written two nested For Each loop in vb.net but face the below problem. Please help me to solve the issue.
Error:
Collection Was Modified
;
Enumeration Operation May Not Execute
.
Code:
Dim monthdt As DataTable = getMonthData()
For Each yearNode As TreeNode In TreeView2.Nodes
For Each row As DataRow In monthdt.Rows
Dim month As New TreeNode()
If row("year").ToString() = yearNode.Text Then
month.Text = row("month").ToString()
month.SelectAction = TreeNodeSelectAction.Select
TreeView2.Nodes.Add(month)
End If
Next
Next
Reply
Answers (
1
)
error in calculation
How to get and save to db in all gridview records in mvc jqu