Ejemplo n.º 1
0
        private void 修改根元素EToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ds.Tables.Count == 0)
            {
                MessageBox.Show("请先读取或创建XML!");
                return;
            }
            InputForm ip = new InputForm();

            ip.text = "请输入根元素名名";
            ip.ShowDialog();
            ds.DataSetName = ip.getText();
            statusRefresh();
        }
Ejemplo n.º 2
0
        private void 添加新列CToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ds.Tables.Count == 0)
            {
                MessageBox.Show("请先读取或创建XML!");
                return;
            }
            DataColumn dc = new DataColumn();
            InputForm  ip = new InputForm();

            ip.text = "请输入列名";
            ip.ShowDialog();
            if (ip.getText() == "")
            {
                return;
            }
            dc.ColumnName = ip.getText();
            ds.Tables[0].Columns.Add(dc);
            statusRefresh();
        }
Ejemplo n.º 3
0
        private void 新建ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ds = new DataSet();
            DataTable  dt = new DataTable();
            DataColumn dc = new DataColumn();
            InputForm  ip = new InputForm();

            ip.text = "请输入根元素名名";
            ip.ShowDialog();
            ds.DataSetName = ip.getText();
            ip             = new InputForm();
            ip.text        = "请输入列名";
            ip.ShowDialog();
            dc.ColumnName = ip.getText();
            dt.Columns.Add(dc);
            ds.Tables.Add(dt);
            dataGridView1.DataSource   = ds.Tables[0];
            toolStripStatusLabel1.Text = "创建完毕!" + "根元素: <" + ds.DataSetName + ">, ";
            Text = "未命名";
        }
Ejemplo n.º 4
0
        private void  除列RToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string    Cname;
            InputForm ip = new InputForm();

            ip.ShowDialog();
            if (ip.getText() == "")
            {
                return;
            }
            Cname = ip.getText();
            foreach (DataColumn dc in ds.Tables[0].Columns)
            {
                if (dc.ColumnName == Cname)
                {
                    ds.Tables[0].Columns.Remove(dc);
                    return;
                }
            }
            dataGridView1.Refresh();
            statusRefresh();
        }