采用反射实现后期绑定。具体代码,呆会给出。
解决方案 »
- 查询一个字段内多个值
- CS架构中服务器确认客户端是否在线的方法
- 搜索的问题
- 请问大家开发过智能分客户端吗 ??
- 有一段文字,我想显示在RichTextBox中,要求每隔一秒钟显示一个单词,怎么做呢?(详情如下)
- 100分,3月份想在北京找份实习工作,在北京的帮忙看看,有没有好的公司介绍
- 控件Masktextbox中mask的设置问题
- 年底开心大散分,呵呵
- 一个数据库插入的简单问题
- FORM中怎么用鼠标滚轮控制滚动条?
- 请问怎样删除dataGrid中被鼠标选中的记录??
- 请教高手: 什么情况下用Global.asax中 GetVaryByCustomString(HttpContext context, String arg) 这个函数? 谢谢!!!
才实现简单的打开Excel并显示的功能.采用这种方法真是累.
还需要一点点VC++的经验.下面是具体的代码:using System;
using System.Reflection;
using System.Windows;
using System.Windows.Forms;class TestLateBound:System.Windows.Forms.Form
{
private Button myButton;
public TestLateBound()
{
myButton=new Button();
myButton.Text="调用EXCEL";
myButton.Location=new System.Drawing.Point(100,100);
myButton.Click+=new System.EventHandler(TestBound);
this.Controls.Add(myButton);
this.Text="测试后期绑定 Excel Application";
}
public void TestBound(object sender,System.EventArgs ef)
{
Type myExcel;
myExcel=Type.GetTypeFromProgID("Excel.Application");
object objExcel;
objExcel=Activator.CreateInstance(myExcel);
object[] param=new object[1];
param[0]=true;
try
{
myExcel.InvokeMember("Visible",BindingFlags.SetProperty,null,objExcel,param);
}
catch (Exception e)
{
MessageBox.Show (e.ToString());
} }
public static void Main()
{
Application.Run(new TestLateBound());
}
}