Hi my friend. Because Stream is disposable. you must Close them after manipulate them.
this code works for me correctly:
switch (e.KeyChar)
{
case'a':
stream.Write(e.KeyChar);
stream.Close();
break;
}
another important thing is using return here. why? tell me.
after case you must use break.
good luck.