Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Good Morning,

I have asked this question yesterday and i didn't get good response. i am working on a resx file. I have read the file and load it on data-gridview. now i wanted to be able to edit from the file and save.I have tried many ways but i didn't come with the solution. yesterday i tried this code below. I don't know how i can edit. please help me.

C#
private void btnSave_Click(object sender, EventArgs e)
     {

             foreach (DataGridViewRow _row in Gridview_Output.Rows)
             {
                 DataRow dt1 = oDataTable.NewRow();
                 for (int i = 0; i < Gridview_Output.ColumnCount; i++)
                 {
                     Gridview_Input.SelectedRows[0].Cells[1].Value =          oDataSet.Tables["data"].Rows[0][1].ToString();
                     Gridview_Input.SelectedRows[0].Cells[2].Value = oDataSet.Tables["data"].Rows[0][2].ToString();
                     Gridview_Input.SelectedRows[0].Cells[3].Value = oDataSet.Tables["data"].Rows[0][3].ToString();
                     Gridview_Input.SelectedRows[0].Cells[4].Value = oDataSet.Tables["data"].Rows[0][4].ToString();
                     oDataTable.Rows.Add(dt1);
                 }
                 oDataSet.Tables.Add(oDataTable);
                 oDataSet.WriteXml(PathSelection);
             }
Posted
Comments
Sinisa Hajnal 10-Feb-15 2:36am    
The code above is button click handler. You're asking how to edit the grid. These are two different things. Is the problem that you cannot enter new values into the grid? Or that save of entered data doesn't work? Do you get some error? You're setting grid values to dataset values, not the other way around. Please explain a bit better.
Bacanzela 10-Feb-15 2:45am    
I have read xml(resx) file and load it to data-gridview. now i want the user to be able to click on the cell and make changes. example, i have comment cell of which the user might edit the comment and click save and changes applied on resx file. how can i achive this?

1 solution

I think you should check this answer - Modifying .resx file in c#[^].

Also - Editing a Resource File Treating It as an XML File[^]
 
Share this answer
 
v2

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