The most likely reason it doesn't work is this line:
foreach (var item in textvalues)
Since
textvalues
is a
string
,
item
will be a
char
- so you will add each individual non-whitespace character in the file to your grid separately.
Unless that's what you want, of course - in which case you will need to explain in much better detail exactly what problem you are having!