PDA

Click to See Complete Forum and Search --> : can create an form into a COM (dll) ?


svatasoiu
Oct 26th, 2001, 04:28 PM
Hi,
I would like to create a com (dll) that, when it will be instantiated to display a form on the screen.
I tried with:

Option Explicit
Dim frmView As VB.TextBox
Public Sub NewDaemon()
Set frmView = New VB.TextBox
With frmView
.Text = "test form"
.Width = 1000
.Height = 1000
.Visible = True
End With

End Sub

When I tri this I receive " Invalid use of NEW"

How can this be done? (ex)

Thank you.

Abu haider
Oct 27th, 2001, 12:38 PM
A TextBox is not a Form, and you can't use it like a Form.

The right way would be:
Add a Form to your COM Component. Name it something like frmCOM.
Add a TextBox on the Form. Name it txtCOM or something.

Then in the NewDaemon Function, do something like as follows:


Public Function NewDaemon()
Dim frm as New frmCOM
frm.txtCOM.Text = "Your Message"
frm.Show vbModal
End Function


It should work the way you want.