我在第二个预填充时不断收到此错误...无法将类型字符串隐式转换为 System.Collections.Generic.IEnumerable,我不确定自己做错了什么。
namespace HomeInventory2
{
public partial class Form1 : Form
{
public Form1(string prepopulated)
{
InitializeComponent();
IEnumerable<String> lines = prepopulated;
textBoxAmount.Text = lines.ElementAtOrDefault(0);
textBoxCategories.Text = lines.ElementAtOrDefault(1);
textBoxProperties.Text = lines.ElementAtOrDefault(2);
textBoxValue.Text = lines.ElementAtOrDefault(3);
}
private void label1_Click(object sender, EventArgs e)
{
}
private void submitButton_Click(object sender, EventArgs e)
{
CreateInventory create = new CreateInventory();
create.ItemAmount = textBoxAmount.Text;
create.ItemCategory = textBoxCategories.Text;
create.ItemProperties = textBoxValue.Text;
create.ItemValue = textBoxValue.Text;
InventoryMngr invtryMngr = new InventoryMngr();
invtryMngr.Create(create);
}
}