Results 1 to 2 of 2

Thread: ActiveX exe problem.

  1. #1

    Thread Starter
    Hyperactive Member TiPeRa's Avatar
    Join Date
    Apr 2001
    Location
    In between
    Posts
    464

    ActiveX exe problem.

    My First ActiveX exe:

    Class1:

    Code:
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Public Form As Form
    Public Cancel As Boolean
    Public Sub go()
        Form.text1.Text = 1
        Do Until Cancel = True
            Sleep 1000
            Form.text1.Text = Form.text1.Text + 1
        Loop
    End Sub
    In another Project:

    Form1

    Code:
    Dim This As New Class1
    Private Sub Command1_Click()
        Set This.Form = Form1
        This.go
    End Sub
    Private Sub Command2_Click()
        This.Cancel = True
    End Sub
    When I run this, the number in the textbox increses by one every second. But when i try to click on Command2 I get:
    Component Request Pending
    An action cannot be completed because a
    component (qwe) in not responding. Choose
    "Swith To" to activate the component and correct
    the problem.

    How can I fix this?
    W#Ć€V€® W¦|| ߀ W¦|| ߀, ÄÑÐ †#€®€ ¦§ ÑÖ†#¦Ñ6 ¥Öµ ©ÄÑ ÐÖ ÄßÖµ† ¦†, §Ö §¦† ßÄ©K, ®€|ÄX ÄÑÐ |€† ¦† #ÄÞÞ€Ñ.
    (Whatever will be will be, and there is nothing you can do about it, so sit back, relax and let it happen.)

  2. #2
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    Append to your code as followed:
    Code:
    'class
    Option Explicit
    
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Public Form As Form
    Public Cancel As Boolean
    Public Sub go()
        Form.Text1.Text = 1
        Do Until Cancel = True
            DoEvents    'added this line to your code
            Sleep 1000
            Form.Text1.Text = Val(Form.Text1.Text) + 1 'avoid type mismatch error
        Loop
    End Sub

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