You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.
The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide
Quote:when i remove from list ,the error displays on screen. why?
impossible to answer. the reason is explained in the error message you didn't post.
Asking questions is a skill
When you will debug your code, pay attention to
, I see where you want to
things, but not what you put in
GIVE THE ERROR MESSAGE !
Quote:I have created list
No what I see; You created a
is not initialization.
Second problem, before removing things from a list, you must start by putting something inside the list.