Using TP Version 6.0.0 Build 462.

OK I'm having this problem with the Whenever - I can't seem to implement it correctly.

If I record and play back such as in the following example - it works.

<font class="small">Code:</font><hr /><pre>
Function Main() As Boolean

DotNETForm("Resource 42 DotNETForm").Attach
DotNETToolStrip("Name=m_viewbar").Select "Inventory"
DotNETTabControl("Name=1000073085").Select "Warehouses"


Whenever "AssertErrorWindowExists"
Whenever "AssertWindowExists"
Whenever "PreAssertWindowExists"

DotNETForm("New Warehouse Item DotNETForm").Attach
End Function

Public Sub Script_Whenever(ByVal TheEvent As TPEvents.TEventGroup)

If TheEvent.Name = "AssertErrorWindowExists" Then
MsgBox "AssertErrorWindowExists"
ElseIf TheEvent.Name = "AssertWindowExists" Then
MsgBox "AssertWindowExists"
ElseIf TheEvent.Name = "PreAssertWindowExists" Then
MsgBox "PreAssertWindowExists"
End If

End Sub
</pre><hr />


If the Sub Script_Whenever is put in with the module that contains Main - it works - but when I move it to a Module of common functions it does not work.

Also if I move the Whenever xyz to the top of Main() it won't work.

At the same time, I have some common functions (in a Common Module) that I would like to put the whenever statements in, but when I try the "Insert -&gt; Event -&gt; Window" from the menu, they never get added. (probably because of #2).

Any help in this matter would be greatly appreciated.