Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

I am new here.

I am currently working on a resource file using windows form. I have a browse button which the user will browse resource file and it get loaded into the Grid-view of which it is working. I also have a button called New, for the user to click new the file must first be loaded on the first grid-view. when new button is clicked it loads the file to the second grid-view. now my questions are as follows

1.How do i load the second grid without the values on it?
2.How can i add new row from the grid-view and it get loaded after you save(if new row/line created it must all ad new block on xml). i hpoe i am clear enough

my code which browse and loads the file to the gridview.

C#
private void btnBrowse1_Click(object sender, EventArgs e)
        {
            try
            {
                BrowseFile();
                //versionIncrement();

                string PathSelection = "";
                if (txtInputfile.Text.Length > 0)
                {
                    PathSelection = txtInputfile.Text;
                }
                oDataSet = new DataSet();
                //now am reading the files from the path that is selected
                XmlReadMode omode = oDataSet.ReadXml(PathSelection);

                for (int i = 0; i < oDataSet.Tables[2].Rows.Count; i++)
                {
                    string comment = oDataSet.Tables["data"].Rows[i][2].ToString();

                    string font = Between(comment, "[Font]","[/Font]");
                    string datestamp = Between(comment, "[DateStamp]", "[/DateStamp]");
                    string commentVal = Between(comment, "[Comment]", "[/Comment]");

                    string[] row = new string[] {       oDataSet.Tables["data"].Rows[i][0].ToString(), oDataSet.Tables["data"].Rows[i][1].ToString(), font, datestamp, commentVal };
                    Gridview_Input.Rows.Add(row);

                    cboLanguage.Enabled = true;
                    btnNewfile.Enabled = true;
                }
            }
Posted
Comments
Sinisa Hajnal 5-Feb-15 9:35am    
1. You bind the columns, but don't set datasource...you get only headers without data
2. Depends on what you mean by add new row. if it depends on the first grid loading, you don't have to add new row, you set the datasource from the XML of the resources.
Bacanzela 5-Feb-15 9:43am    
can you give me a hint on how i can do it? when the file loads from the second grid-view, the user must be able to write new column and save from the grid-view

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