Results 1 to 4 of 4

Thread: How to creating an instance of an ActiveX control without placing it on a form

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    How to creating an instance of an ActiveX control without placing it on a form

    Dear The Expert,
    How to creating an instance of an ActiveX control without placing it on a form? (ie. to create textbox control in module1.bas) and
    how to trigger the event?


    please advise ..

    Regards
    Winanjaya

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    First of all do you really mean 'ActiveX' control? Or do you mean just creating a .NET control (which are not Active X controls). ActiveX controls are specific to VB6 and earlier versions.

    ActiveX controls may give you issues related to not having a windows handle without a form but maybe not, I'm just guessing.

    If you mean .NET controls then just declare and use it but what do you mean by events? What exactly are you trying to do?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784
    I am just trying to create object (ie. textbox) programmatically and trigger the event (such as the keypress and change event handler) .. please advise ..


    Thanks and Regards

    Winanjaya

  4. #4
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    dunno if this helps
    VB Code:
    1. Dim b As New Button()
    2.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    3.         AddHandler b.Click, AddressOf b_click
    4.     End Sub
    5.  
    6.     Sub b_click(ByVal sender As Object, ByVal e As EventArgs)
    7.         MessageBox.Show("hello world")
    8.     End Sub
    9.  
    10.     Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
    11.         If e.Control And e.KeyCode = Keys.B Then
    12.             b_click(Me, Nothing)
    13.         End If
    14.     End Sub
    if not, sorry.

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