I am trying to teach myself to develop activex controls for embedding in a web page, and I am having some trouble getting the control to appear. I had it working at one point, but then it just stopped working, and I can't figure out what I changed that caused it to stop working.
the following is my C# code verbatim from my project:
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace MyActivexControl
{
[Guid("6616AE32-2EC0-4B10-9BB2-71679687EBA4"), ClassInterface(ClassInterfaceType.AutoDual)]
public class MyActivexControl : UserControl
{
TextBox txtTestTextBox;
Button btnTestButton;
Label lblTestLabel;
public MyActivexControl()
{
InitializeComponent();
}
void InitializeComponent()
{
this.Size = new System.Drawing.Size(200, 200);
txtTestTextBox = new TextBox();
txtTestTextBox.Size = new Size(96, 24);
txtTestTextBox.Location = new Point(8, 8);
this.Controls.Add(txtTestTextBox);
btnTestButton = new Button();
btnTestButton.Text = "Click Me";
btnTestButton.Size = new Size(80, 24);
btnTestButton.Location = new Point(112, 8);
btnTestButton.Click += new EventHandler(btnTestButton_Click);
this.Controls.Add(btnTestButton);
lblTestLabel = new Label();
lblTestLabel.Size = new Size(96, 24);
lblTestLabel.Location = new Point(8, 40);
this.Controls.Add(lblTestLabel);
}
private void btnTestButton_Click(object sender, EventArgs e)
{
lblTestLabel.Text = txtTestTextBox.Text;
}
}
}
and the html code for embedding the object:
Code:
<div id="myActivexControl">
<object id="myControl" name="myControl" classid="MyActivexControl.dll#MyActivexControl.MyActivexControl"
style="width:200px; height:200px; background-color:inherit; font-family:Arial; color:inherit; font-style:inherit; font-size:inherit" />
</div>
the assembly file is in the root of the web server (visual studio's integrated server), and like I said, it was working fine before, but then without warning, it stopped working. a placeholder of the correct size appears in the browser, but it's empty.