I have created an application where I have to load the .resx file and display the contents of the .resx file in the datagridview. I am loading the .resx through menustrip. I have tried using the following code, but no data show up in the datagridview
Code
private void openToolStripMenuItem_Click(object sender, EventArgs e)Code
{Code
OpenDialog.Reset();Code
OpenDialog.InitialDirectory = Directory.GetCurrentDirectory();Code
OpenDialog.RestoreDirectory = false;Code
OpenDialog.Filter = "Resource files (*.resx)|*.resx"; iCode
f (OpenDialog.ShowDialog() == DialogResult.OK)Code
{Code
StreamReader MyStream = new StreamReader(OpenDialog.FileName);Code
BBookGrid.DataSource = null;Code
m_BBookTable.Clear(); //Clear the existing tableCode
BBookGrid.DataSource = m_BBookTable;Code
tryCode
{Code
while (true)Code
{Code
String MyLine = MyStream.ReadLine();Code
if (MyLine == null)Code
{Code
break;Code
}Code
else if (MyLine.Length != 0)Code
{ String[] fields = MyLine.Split(Separator.ToCharArray());Code
if (fields.GetLength(0) == NumColumns)Code
{Code
m_BBookTable.Rows.Add(m_BBookTable.NewRow());Code
m_BBookTable.Rows[m_BBookTable.Rows.Count - 1][SourceCol] = fields[0].Trim();Code
m_BBookTable.Rows[m_BBookTable.Rows.Count - 1][TargetCol] = fields[1].Trim(); } } } }Code
catch (Exception ex)Code
{ MessageBox.Show("Fatal Error" + ex.ToString());Code
Application.Exit(); } } }
Answers
Know the answer? Post it. Somebody with the same question will find it here.