I keep getting this error – The best overloaded method match for HomeInventory2.Form1.Form1(System.Collections.Generic.IEnumerable) has some invalid arguments – for the starred section. At the same time I am also getting this error in the same spot – Argument 1: cannot convert from ‘string’ to System.Collections.Generic.IEnumerable
**Sorry – I should have added, the code sends a string to another form where it is split up and placed into separate text boxes.
namespace HomeInventory2
{
public partial class Form2 : Form
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, System.EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.RichText);
}
}
private void button2_Click(object sender, EventArgs e)
{
Application.Run**(new Form1(richTextBox1.Text))**;
}
}
}
First off, you probably don’t want to call
Application.Runhere – you already have a form.I suspect you want to split the rich text box content by lines, then pass this to the new form and show it. If that is the case, you can do: