Results 1 to 2 of 2

Thread: can create an form into a COM (dll) ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    MA, US
    Posts
    78

    Exclamation can create an form into a COM (dll) ?

    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.

  2. #2
    Hyperactive Member
    Join Date
    Sep 2001
    Location
    Orlando
    Posts
    392

    Wrong Understanding...

    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:

    VB Code:
    1. Public Function NewDaemon()
    2.     Dim frm as New frmCOM
    3.     frm.txtCOM.Text = "Your Message"
    4.     frm.Show vbModal
    5. End Function

    It should work the way you want.
    Abu Haider
    ____________________________
    100% Data Validation for the MS DataGrid Control. Plus Support for Custom and Foreign Lists, DatePicker and much more...
    The DataGridEnhancer


    I often point to a place where the problem has been discussed, instead of giving you the code that solves it. This is for good, may be you will understand some day...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width