C#编程:windows窗体应用程序中,如何读取txt中数据(数据每行一个)到某个参数下
publicvoidBtnLoadData2_Click(objectsender,EventArgse){//加载数据OpenFileDialogopenFileDia...
public void BtnLoadData2_Click(object sender, EventArgs e)
{
//加载数据
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "文件(*.txt)|*.txt|所有文件(*.*)|*.*";
openFileDialog.Title = "选择打开文本数据";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string strFullPath = openFileDialog.FileName;//"C:\\Users\\shayukun\\Desktop\\统计评分.txt"
(函数代码怎么写?)
}
else
{
MessageBox.Show("请选择一个文件");
}
} 展开
{
//加载数据
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "文件(*.txt)|*.txt|所有文件(*.*)|*.*";
openFileDialog.Title = "选择打开文本数据";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string strFullPath = openFileDialog.FileName;//"C:\\Users\\shayukun\\Desktop\\统计评分.txt"
(函数代码怎么写?)
}
else
{
MessageBox.Show("请选择一个文件");
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询