c# - read .resx file and display the contents in datagridview -


I have created an application where I need to load the .resx file and display the contents of the .resx file in the DataArgewview is . I am loading .resx through the mainstrip. I have tried to use the following code, but no data has been shown.

  Private Zero openToolStripMenuItem_Click (Object Sender, EventArgs E) {OpenDialog.Reset (); OpenDialog.InitialDirectory = Directory.GetCurrentDirectory (); OpenDialog.RestoreDirectory = false; OpenDialog.Filter = "Resource Files (* .resx) | * .resx"; If (OpenDialog.ShowDialog () == DialogResult.OK) {StreamReader MyStream = New StreamReader (OpenDialog.FileName); BBookGrid.DataSource = null; M_BBookTable.Clear (); // Clear the existing table BBookGrid.DataSource = m_BBookTable; Try {while (true) {String MyLine = MyStream.ReadLine (); If (myline == empty) {break; } Else if (MyLine.Length! = 0) {string [] field = MyLine.Split (separator. ToCharArray ()); If (fields.GetLength (0) == NumColumns) {m_B Bookable.Rows.Add (m_BBookTable.NewRow ()); M_BBookTable.Rows [m_BBookTable.Rows.Count - 1] [SourceCol] = Field [0] .Trim (); M_BBookTable.Rows [m_BBookTable.Rows.Count - 1] [TargetCol] = Field [1] .Trim (); }}}} Hold (Exception Pre) {messagebox.Show ("Fatal Error" + ex.ToString ()); Application.Exit (); }}}}    

You set the data source after Would you have filled it with data!

  Private Zero openToolStripMenuItem_Click (Object Sender, EventArgs e) {OpenDialog.Reset (); OpenDialog.InitialDirectory = Directory.GetCurrentDirectory (); OpenDialog.RestoreDirectory = false; OpenDialog.Filter = "Resource Files (* .resx) | * .resx"; If (OpenDialog.ShowDialog () == DialogResult.OK) {StreamReader MyStream = New StreamReader (OpenDialog.FileName); BBookGrid.DataSource = Faucet; M_BBookTable.Clear (); // Clear the current table ///BBookGrid.DataSource = m_BBookTable; /// This line should be after / after capture, after filling the data source. Try {while (true) {String MyLine = MyStream.ReadLine (); If (myline == empty) {break; } Else if (MyLine.Length! = 0) {string [] field = MyLine.Split (separator. ToCharArray ()); If (fields.GetLength (0) == NumColumns) {m_B Bookable.Rows.Add (m_BBookTable.NewRow ()); M_BBookTable.Rows [m_BBookTable.Rows.Count - 1] [SourceCol] = Field [0] .Trim (); M_BBookTable.Rows [m_BBookTable.Rows.Count - 1] [TargetCol] = Field [1] .Trim (); }}}} Hold (Exception Pre) {messagebox.Show ("Fatal Error" + ex.ToString ()); Application.Exit (); } // Now data is we set the data source! BBookGrid.DataSource = m_BBookTable; }}    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -