如何在运行时在visual basic 2010中的程序屏幕中上传EXCEL文件 [英] How to uplode EXCEL file in program screen in visual basic 2010 in runtime

查看:88
本文介绍了如何在运行时在visual basic 2010中的程序屏幕中上传EXCEL文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试一个打开的文件对话框,在运行时将excel文件带到我的程序中

但错误的是对查询字符串和内存不感兴趣

i am trying a open file dialog to bring a excel file in my program in run time
but err comes "be shure about query string and memory "

OFGESelectfile3

重命名

open file dialo



和过滤器


and filter is

JPEG Files| *.JPG|GIF Files|*.GIF|Windows Bitmaps|*.BMP|Excel fiels|*.xlsx





我尝试过:





What I have tried:

Private Sub cmdaddexl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdaddexl.Click
       If OFGESelectfile3.ShowDialog = Windows.Forms.DialogResult.OK Then
           PictureBox1.Image = Image.FromFile(OFGESelectfile3.FileName)
       End If
   End Sub

推荐答案

等一下。您是否尝试使用PictureBox控件将Excel工作簿加载为图像?是的,那不行。 PictureBox控件不知道如何处理Excel工作簿。



如果你试图在Windows窗体表格中显示Excel工作表,那就复杂得多而不是你所展示的代码。 在Windows窗体应用程序中集成excel [ ^ ]
Wait a second. You're trying to get a PictureBox control to load an Excel workbook as an Image? Yeah, that's not going to work. The PictureBox control has no idea what to do with an Excel workbook.

If you're trying to show an Excel sheet in a Windows Forms Form, it's considerably more complicated than the code you've shown. integrate excel in windows form application[^]


这篇关于如何在运行时在visual basic 2010中的程序屏幕中上传EXCEL文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆