Click here to Skip to main content
15,891,708 members
Please Sign up or sign in to vote.
3.00/5 (3 votes)
See more:
I have below code with me .
But it gives me the error : Unrecognized escape sequence
C#
Path ="D:\AAIGUILDMAY10.csv";


Here is my code
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class FrmImportFile : Form
    {
        public FrmImportFile()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string Path;
            Path ="D:\AAIGUILDMAY10.csv";
            dataGridView1.DataSource = ControlRules.ClsConnect.ReadCSV();
        }
    }
}
Posted
Updated 19-Apr-11 23:44pm
v3

1 solution

use either
Path = @"D:\AAIGUILDMAY10.csv";

that makes the string unparsed

or
Path ="D:\\AAIGUILDMAY10.csv";

this escapes the "\"


Cheers
 
Share this answer
 
v2
Comments
Espen Harlinn 8-Jan-11 9:32am    
5+ Not much more to say about that ...
RDBurmon 8-Jan-11 9:43am    
thanks Estys.
fjdiewornncalwe 8-Jan-11 13:10pm    
+5. I have nothing more to say about that, except that my comment is longer than Espen's... :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900