i want to print my input file data to textbox but it shows error here is code
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
File.WriteAllLines(file1, richTextBox1.Text); // file1 is my input file
}
errors are:
// Error 3 Argument 1: cannot convert from 'System.Collections.Generic.List<string>' to 'string'
// Error 4 Argument 2: cannot convert from 'string' to 'System.Collections.Generic.IEnumerable<string>'
So my question is that how to convert list to string and string to IEnumerable<string>?
private void button1_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = ".cs File Detector";
fdlg.InitialDirectory = @"c:\";
fdlg.Filter = "cs files (*.cs)|*.cs";
fdlg.FilterIndex = 2;
fdlg.RestoreDirectory = true;
if (fdlg.ShowDialog() == DialogResult.OK)
{
textBox1.Text = fdlg.FileName;
}
}
catch (Exception eee)
{
MessageBox.Show(eee.ToString());
}
}
I am calling file from here so now shall do the same thing to readtext for text box?
You want to read, not write: