Can anyone help me in deleting a row in a text file....


Thanks.

Can you please be more specific about your problem.......
:)

/// <summary>
    /// 
    /// </summary>
    /// <param name="FileName"></param>
    /// <param name="LineNumber">The 0-based line number</param>
    private static void DeleteLineNumber(string FileName, int LineNumber)
    {
      if (!File.Exists(FileName))
        throw new FileNotFoundException("File not found.", FileName);
      if (LineNumber < 0)
        throw new ArgumentOutOfRangeException("LineNumber", "Must be >= 0");
      List<string> lst = File.ReadAllLines(FileName).ToList();
      lst.RemoveAt(LineNumber);
      File.WriteAllLines(FileName, lst.ToArray());
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.