Z
Zach
Using the code below I want to read a list of French words into the list
box. However the code dysfunctions because of the é, à etcetera in the
file that is being read. Could someone tell me how to rewrite the code
to ameliorate this problem?
Presumably this code needs to be amended:
while ((line = sr.ReadLine())!= null)
Presumably with Iformatprovider,
but I don't know how to do that.
Please be explicit.
Thank you,
Zach.
void fillListBox()
{
ArrayList words = new ArrayList();
try
{
string file_string = "data.txt";
using (StreamReader sr = new StreamReader(file_string))
{
String line;
while ((line = sr.ReadLine())!= null)
{
int pos = 0;
pos = line.IndexOf(":");
listBox1.Items.Add(line.Substring(0,pos));
}
}
}
catch
{
}
}
box. However the code dysfunctions because of the é, à etcetera in the
file that is being read. Could someone tell me how to rewrite the code
to ameliorate this problem?
Presumably this code needs to be amended:
while ((line = sr.ReadLine())!= null)
Presumably with Iformatprovider,
but I don't know how to do that.
Please be explicit.
Thank you,
Zach.
void fillListBox()
{
ArrayList words = new ArrayList();
try
{
string file_string = "data.txt";
using (StreamReader sr = new StreamReader(file_string))
{
String line;
while ((line = sr.ReadLine())!= null)
{
int pos = 0;
pos = line.IndexOf(":");
listBox1.Items.Add(line.Substring(0,pos));
}
}
}
catch
{
}
}