I think this should work:
--------------------------------------...
private void button2_Click(object sender, System.EventArgs e)
{
try
{
//Create instance for openFileDialog i.e. open_file
OpenFileDialog open_file=new OpenFileDialog();
open_file.Filter="XML Files|*.xml";
open_file.DefaultExt="xml";
DialogResult Dialog_result=open_file.ShowDialog(this)...
if (Dialog_result==DialogResult.OK)
{
string fn=open_file.FileName;
DataSet ds=new DataSet();
ds.ReadXml(fn);
lbTables.Items.Clear();
foreach (DataTable dt in ds.Tables)
{
lbTables.Items.Add(dt.TableName);
}
Ds_xml=ds;
lbTables.SelectedIndex=0;
fnSchema=fn;
this.Text="XML Database Editor - "+fnSchema;
TextBox tablename=new TextBox();
string tblName=lbTables.Text;
dataGrid1.SetDataBinding(Ds_xml, tblName);
dataGrid1.CaptionText="Table: "+tblName;
}
}
catch(Exception ex){
MessageBox.Show(ex.ToString());
}}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment