📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Ex15_02
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string strPath=null;//文件咱径
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "xml文件|*.xml";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
strPath = openFileDialog1.FileName;
}
}
private void button2_Click(object sender, EventArgs e)
{
if (strPath != null)
{
DataSet ds = new DataSet();
ds.ReadXmlSchema(strPath);
ds.ReadXml(strPath);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
else
{
MessageBox.Show("请选择XML文件");
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -