xolela
03-16-04, 01:21 AM
Can Some Body Correct My Code, I want to Create ActiveX Control and Embed it in a HTML Page. Currently, it doesn't diplay the Control on the form. In VB6 I used to come up with .OCX file but here, I just can't get it. Please help me out, I need this Very Urgently. Please tell me all the steps I need to do to accomplish my goal.
I also atthached the files
Here is the code for the ActiveX Control
Namespace ActiveXDotNet
Public Interface AxMyControl 'userControl
Property UserText() As String
End Interface 'AxMyControl
Public Class myControl
Inherits System.Windows.Forms.UserControl
Private mStr_UserText As String
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'UserControl1 overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents txtUserText As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.txtUserText = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'txtUserText
'
Me.txtUserText.Location = New System.Drawing.Point(176, 8)
Me.txtUserText.Name = "txtUserText"
Me.txtUserText.Size = New System.Drawing.Size(176, 20)
Me.txtUserText.TabIndex = 0
Me.txtUserText.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(128, 16)
Me.Label1.TabIndex = 1
Me.Label1.Text = "User Text"
'
'UserControl
'
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtUserText)
Me.Name = "UserControl"
Me.Size = New System.Drawing.Size(360, 40)
Me.ResumeLayout(False)
End Sub
#End Region
Public Property dd() As Integer
Get
End Get
Set(ByVal Value As Integer)
End Set
End Property
Public Property UserText() As [String]
Get
Return mStr_UserText
End Get
Set(ByVal Value As String)
mStr_UserText = Value
'Update the text box control value also.
txtUserText.Text = Value
End Set
End Property
End Class
End Namespace
Here is the code for the HTML Page
<html>
<body color=white>
<hr>
<font face=arial size=1>
<OBJECT id="myControl1" name="myControl1" classid="ActiveXDotNet.dll#ActiveXDotNet.myControl" width=288 height=72>
</OBJECT>
</font>
<form name="frm" id="frm">
<input type="text" name="txt" value="enter text here"><input type=button value="Click me" onClick="doScript();">
</form>
<hr>
</body>
<script language="javascript">
function doScript()
{
myControl1.UserText = frm.txt.value;
}
</script>
</html>
Thank You In Advance
I also atthached the files
Here is the code for the ActiveX Control
Namespace ActiveXDotNet
Public Interface AxMyControl 'userControl
Property UserText() As String
End Interface 'AxMyControl
Public Class myControl
Inherits System.Windows.Forms.UserControl
Private mStr_UserText As String
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'UserControl1 overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents txtUserText As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.txtUserText = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'txtUserText
'
Me.txtUserText.Location = New System.Drawing.Point(176, 8)
Me.txtUserText.Name = "txtUserText"
Me.txtUserText.Size = New System.Drawing.Size(176, 20)
Me.txtUserText.TabIndex = 0
Me.txtUserText.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(128, 16)
Me.Label1.TabIndex = 1
Me.Label1.Text = "User Text"
'
'UserControl
'
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtUserText)
Me.Name = "UserControl"
Me.Size = New System.Drawing.Size(360, 40)
Me.ResumeLayout(False)
End Sub
#End Region
Public Property dd() As Integer
Get
End Get
Set(ByVal Value As Integer)
End Set
End Property
Public Property UserText() As [String]
Get
Return mStr_UserText
End Get
Set(ByVal Value As String)
mStr_UserText = Value
'Update the text box control value also.
txtUserText.Text = Value
End Set
End Property
End Class
End Namespace
Here is the code for the HTML Page
<html>
<body color=white>
<hr>
<font face=arial size=1>
<OBJECT id="myControl1" name="myControl1" classid="ActiveXDotNet.dll#ActiveXDotNet.myControl" width=288 height=72>
</OBJECT>
</font>
<form name="frm" id="frm">
<input type="text" name="txt" value="enter text here"><input type=button value="Click me" onClick="doScript();">
</form>
<hr>
</body>
<script language="javascript">
function doScript()
{
myControl1.UserText = frm.txt.value;
}
</script>
</html>
Thank You In Advance