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
priyanka bhatnagar
NA
48
10.3k
Items collection cannot be modified when the DataSource prop
May 5 2015 6:41 AM
I got error in the below code on keyup event of combobox
private void comboKeyPressed()
{
cboAuthor.DroppedDown = true;
object[] originalList = (object[])cboAuthor.Tag;
if (originalList == null)
{
// backup original list
originalList = new object[cboAuthor.Items.Count];
cboAuthor.Items.CopyTo(originalList, 0);
cboAuthor.Tag = originalList;
}
// prepare list of matching items
string s = cboAuthor.Text.ToLower();
IEnumerable<object> newList = originalList;
if (s.Length > 0)
{
newList = originalList.Where(item => item.ToString().ToLower().Contains(s));
}
// clear list (loop through it, otherwise the cursor would move to the beginning of the textbox...)
while (cboAuthor.Items.Count > 0)
{
cboAuthor.Items.RemoveAt(0);
// cboAuthor.Items.Remove(cboAuthor.SelectedIndex);
}
// re-set list
cboAuthor.Items.AddRange(newList.ToArray());
}
Reply
Answers (
1
)
File access from Remote machine using SQL DB
Window form application