0
我在C#中有一個簡單的「登錄」屏幕,用戶將按下Login並彈出另一個窗口,表示歡迎並且在Visual /工作室。使用VBA(Access 2010)打開C#表單(.dll)
下面是代碼
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Login_Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Welcome");
this.Close();
}
}
}
我也有一個VBA形式(Access 2010中),其中一個用戶會點擊一個按鈕,然後在C#的形式應該彈出,並在未來,而不是說「歡迎光臨「它將在Access中重定向到不同的表單。
下面是VBA按鈕的代碼:我所做的.DLL,.TLB,使用regasm它
Private Sub Command284_Click()
Dim objLog As Login_Test.Form1
Set objLog = New Login_Test.Form1
End Sub
,並引用它的訪問。
當按下按鈕時,得到:「運行時錯誤429 activex組件無法創建對象」。
我錯過了什麼嗎?在管理員模式下
它是'ComVisible'? – cyboashu
@cyboashu我會在那裏放行([ComVisibleAttribute(true)])? – Nate
在dll的入口點(dll的主/根類)看到這個:http://stackoverflow.com/questions/7092553/turn-a-simple-c-sharp-dll-into-a-com-interop-component – cyboashu