使用DialogBox将文件从Excel加载到DataGridView [英] Load file from Excel to DataGridView with DialogBox
本文介绍了使用DialogBox将文件从Excel加载到DataGridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的
我正在尝试将Excel文件加载到DataGridView.我希望我的用户可以自己选择文件,因此请使用对话框.理想情况下,我想将路径作为文本添加到标签,然后获取数据sourse = label.text ...但是它作为错误出现:只读",这是什么 文件关闭很奇怪,只有我在使用它.能否请您提供帮助和建议.
I am trying to load excel file to DataGridView. I want my user to be able to select file himself, so use dialog box. Ideally I wanted to add path as text to label and then get data sourse = label.text... However it come up as error: 'read only', what is weird as file is closed and there is only me using it. Can you please kindly help and advice on that.
非常感谢你,朱莉.
我正在使用的代码是:
结束班级
推荐答案
我自己搞定的: Data Source =" + Label2.Text.ToString()+
I got it myself: Data Source=" + Label2.Text.ToString() + "
=)
这篇关于使用DialogBox将文件从Excel加载到DataGridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文