How to close a form that is open in ShowDialog, from another form

JohnPapa

Registered User.
Local time
Today, 19:37
Joined
Aug 15, 2010
Messages
1,088
In response to a telephone call, I use the following code to open a form at the lower right corner of the screen to display the users who have this telephone number. When a call is received, the telephone system does something very simple, it executes a batch file and passes the telephone number as a parameter and the batch file creates a file, whose contents are this telephone number. To simplify matters, when a call is made, I can receive a string with the telephone number of the caller and I can pass the telephone number to a form (frmCallerIn) which looks up this telephone number and displays all the users that have this telephone number.

I use the following code to position the form on the lower bottom right of the screen.

Me.Location = New Point(scr.WorkingArea.Right - Me.Width, scr.WorkingArea.Bottom - Me.Height)

I can open the form with
Dim frm2 = New frmCallerIn(sbuf)
frm2.ShowDialog()

I created a Timer programmatically to close the form after say 10 seconds and the Timer is disabled if I click on the form.
When the Timer is disabled, the form will remain on the screen until I exit from the form, even if a new call comes in.

Is there a way to be able to close the form, once a new call comes in. Would opening the form in a separate thread help?
 
you cannot shut a dialog from another form BECAUSE its in dialog.
Just close it from the dialog.
 
Perhaps consider just opening the form as Modal, instead of Dialog.
 

Users who are viewing this thread

Back
Top Bottom