Hello guys,
I'm trying to create a simple Usercontrol in VB.NET to use it in Excel (32bit and 64bit).
The Usercontrol is having one Textbox and one Button.
When I try to insert it in Excel, it gives me this error:
"The selected file does not contain any self-registering activex controls"
In Application > Assembly Information > Make Assembly COM-visible - is checked
The code is:
Code:Namespace ActiveXDotNet Public Interface AxMyControl Property UserText() As String End Interface 'AxMyControl Public Class UserControl1 Inherits System.Windows.Forms.UserControl Implements AxMyControl Private mStr_UserText As String Public Property UserText1() As String Implements AxMyControl.UserText Get Return mStr_UserText End Get Set(ByVal Value As String) mStr_UserText = Value 'Update the text box control value also. Me.TextBox1.Text = mStr_UserText End Set End Property Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click MessageBox.Show(Me.TextBox1.Text) End Sub Friend WithEvents TextBox1 As TextBox Friend WithEvents Button1 As Button Private Sub InitializeComponent() Me.TextBox1 = New System.Windows.Forms.TextBox() Me.Button1 = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(89, 34) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(333, 20) Me.TextBox1.TabIndex = 0 ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(208, 76) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(75, 23) Me.Button1.TabIndex = 1 Me.Button1.Text = "Button1" Me.Button1.UseVisualStyleBackColor = True ' 'UserControl1 ' Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.TextBox1) Me.Name = "UserControl1" Me.Size = New System.Drawing.Size(497, 124) Me.ResumeLayout(False) Me.PerformLayout() End Sub End Class End Namespace




Reply With Quote
