Click here to Skip to main content
15,904,155 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi! developer
Myself vishal sharma

problem:

I have major problem to replace the values in datagridveiw
and datagridveiw not have replace method
I m load a csv file into the dataset and veiw then into the datagridveiw
But problem is that wildcards attach with the values like "INC0067889",
but wildcards can not remove form all columns
string str="";
char ctr='"';

I want to replace(ctr.tostring(),str.tostring());
and want a result like this for all columnms

INC0067889
please solve my problem imediatly this is my request to you
my ID is [Removed]
Posted
Updated 7-Nov-10 23:19pm
v2

C#
DataTable dt = new DataTable();
        dt.Columns.Add("Name");
        DataRow dr = dt.NewRow();
        dr["Name"] = '"' + "INC0067889" + '"';
        dt.Rows.Add(dr);

        DataTable dtNew = new DataTable();
        dtNew = dt.Clone();
        char replace = ' ';
        foreach (DataRow d in dt.Rows)
        {
            DataRow dRow = dtNew.NewRow();
            dRow["Name"] = d["Name"].ToString().Replace('"', replace).ToString();
            dtNew.Rows.Add(dRow);
        }
 
Share this answer
 
v3
Comments
Dalek Dave 8-Nov-10 5:36am    
Edited for Code Blocks.
 
Share this answer
 

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