C# string to combobox issues
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-05-10T16:48:54Z
Indexed on
2010/05/10
16:54 UTC
Read the original article
Hit count: 121
c#
What i'm trying to do is read in a header row of a file to a combobox. Here is my code:
private void button4_Click(object sender, EventArgs e)
{
string[] startdelim = File.ReadAllLines(textBox1.Text);
int counter = 1;
foreach (string delim in startdelim)
{
if (counter == 1)
{
string removedelim = delim.Replace("\"", "");
string[] lines = removedelim.IndexOf(",");
foreach (string line in lines)
{
comboBox1.Items.Add(line);
}
}
counter++;
}
for some reason it keeps telling me Error Cannot implicitly convert type 'int' to 'string[]' at string[] lines = removedelim.IndexOf(",");
© Stack Overflow or respective owner