C# 中datagridview如何导入txt文件,重金酬谢
privatevoid打开ToolStripMenuItem_Click(objectsender,EventArgse){openFileDialog1.Title="...
private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog1.Title = "打开";
openFileDialog1.InitialDirectory = @"D:\cici";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string fileName = openFileDialog1.FileName;
dataGridView1.DataSource =File.ReadAllLine(fileName);
}
这是我的代码,但是导入的是txt每行的个数,不是每行的内容,求解中ing... 展开
{
openFileDialog1.Title = "打开";
openFileDialog1.InitialDirectory = @"D:\cici";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string fileName = openFileDialog1.FileName;
dataGridView1.DataSource =File.ReadAllLine(fileName);
}
这是我的代码,但是导入的是txt每行的个数,不是每行的内容,求解中ing... 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询