Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer Control 1

Status
Not open for further replies.

bhargava

MIS
May 3, 2001
26
0
0
IN
hi all

I am working on an application where from an ActiveX Control I call a VB form. Once the user has finished working on the form, he closes the form. Now the value entered in the form are previewed in the control.

What I want is that without any event being fired on the control, the user should be able to see the contents of the form, as soon as he closes the form.

I tried doing so using Timer control, and my logic is as follows:

1. When form is loaded start a counter using timer, and is incremented until user closes the form.

2. Using counter as global variable, I make it visible to both, -the form and the control.

3. On the control create another timer, and decrement the global counter. When counter reaches a specific value, display the contents of the form over the control.

My problem:

The counter works fine, till the form is available on the screen. When I implement point 3 in the control, nothing happens.

can anyone help.

Regards

Amit
 
Instead of having an event being fired on the control, why not have a public property that the form sets when it gets unloaded via the "OK" or "Save" button?

Chip H.
 
hi,

can u help that out with some code. I tried what you are saying but unable to get that work for me.

regards

Amit
 
OK, in your control you'd have something like this to load the form:
[tt]
:
Set m_TheForm = New frmVerify
Set m_TheForm.CallerRef = Me
m_TheForm.Show vbModal
:
[/tt]

And in another part of your control, you'd have code to receive notification when the user is done with the Verify form:
[tt]
Public Sub FormIsDone()
'Do something here when the Verify form is completed

Set m_TheForm = Nothing
End Sub
[/tt]

and in your form, you'd have code like:
[tt]
Private m_objCallerRef as object

Public Property Set CallerRef(RHS as Object)
Set m_objCallerRef = RHS
End Property

Private Sub cmdSave_Click()

Call m_objCallerRef.FormIsDone()
Unload Me
End Sub
[/tt]

So, you let the form know who his parent (caller) is, and then when the user clicks the save button, you let the parent know via that reference. The code in the form then continues to unload itself.

Hope this helps.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top