oren.turgeman.9 0 Newbie Poster

hy i have csv file with ","
for example

f_name,l_name,city,country..... (this is the headers)
david,d,tel-aviv,israel
shon,d,q-gat,israel

i need to replace on specific column once (example city) ,

for example : if columnheader = "city" then replace (alldata in this column from "-" to`).....

 int i = 1;
            int z = 0;
            int zz = 0;
            MessageBox.Show (cmbLoadHeader.Text);
            ///  using ( TextFieldParser parser = new TextFieldParser(@"C:\convertor\CustomerPhysician20140525-Copy.csv"))
            TextFieldParser parser = new TextFieldParser(@"C:\convertor\CustomerPhysician20140525-Copy.csv");

            parser.TextFieldType = FieldType.Delimited;
            parser.SetDelimiters(",");
            while (!parser.EndOfData)
            {
                //Process row
                string[] fields = parser.ReadFields();
                foreach (string field in fields)
                {
                    //TODO: Process field
                    if (z!= 0)

                    {
                        if (zz == z-1) ///city column
                        {
                            MessageBox.Show(field);
                            ReplaceLineByLine(field, "`"); ======this is my function that i dont have yet
                        }
                        else
                        {
                            zz = zz + 1;

                        }

                        MessageBox.Show(field);
                    }
                    if (field == cmbLoadHeader.Text) ///city for example
                    {

                        MessageBox.Show(field);
                        MessageBox.Show(i.ToString());
                        z=i;
                        break;
                    }
                    else
                    {
                        i = i + 1;
                    }
                    MessageBox.Show(field);
                }
               /// break;
            }
            parser.Close();
        }




       }


    }