Hi Guys,
I am reading a text file and i want to store that file ina string, below is my code, can anyone tell me what am i doing wrong
private void toolStripButton1_Click(object sender, EventArgs e)
{
// OpenFileDialog dialog = new OpenFileDialog();
FolderBrowserDialog dialog1 = new FolderBrowserDialog();
parser = new GrammarParser();
parser.showStep += new GrammarParser.ShowStep(parser_showStep);
if (dialog1.ShowDialog() == DialogResult.OK)
{
string nameD = dialog1.SelectedPath;
string[] names = Directory.GetFiles(nameD, "*txt");
for (int i = 0; i < names.Length; i++)
{
TextReader txtread = new StreamReader(names[i]);
MessageBox.Show(txtread.ReadToEnd());
// read file to the string
string text = txtread.ReadToEnd();
parser.Text = text;
resultString = parser.SerParserString;
// go to to database
}
}
}