circular calling windows

H

Hennie7863

Hi,

I have two forms A and B. Om form B i have a NEW button which should
call form A and after a selection on form A it will call form B again.
Hence a circular calling of forms.

On both forms i created a event:

Private Sub frmFormA_Deactivate(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Deactivate
Me.Hide()
End Sub

This will work when calling windows in a tree but not in a circular
reference. When i click outside the form (A or B) it will hide the
form. Can someone help me with this issue?

Hennie
 
G

GhostInAK

Hello Hennie7863,

By "tree" I assume you mean treeview. In this case don't use the Deactivate
event. Store the form reference somewhere (oCurrentForm) and when the user
clicks a different node in the tree you can do.. oCurrentForm.Hide

-Boo
 
H

Hennie7863

I'm sorry ididn't reply earlier. I had to finish some other problems. I
have three windows F1, F2 and F3.

F1 = Treeview+listview screen
F2 = Selectionscreen(with 3 options)
F3 = Edit screen with a New button. New calls F2 again

F1 can call F2 (new)
F1 can call F3 (edit an entry)
F2 can call F3 (a new entry)
F3 can call F2 (new is pressed)

i'm struggling with the show and showdialog property. At this moment i
use the following code :

F1 :
edit button:
Dim F3 As frmF3 = New frmF3(item)
frmF3.ShowDialog()

new button:
Dim F2 As frmF2 = New frmF2(item)
frmF2.ShowDialog()

F2 :
ok button
Dim F3 = New frmF3(Me)
F3.Showdialog()

F3 :
Private CallingForm As Object 'in the main declaration area

Public Sub New(ByVal Caller As Object) ' in the New constructor
CallingForm = Caller ' in the New
constructor

New button
Me.Close()
If Not IsNothing(CallingForm) Then

CallingForm.Top =
(Screen.PrimaryScreen.WorkingArea.Height - CallingForm.Height) / 2
CallingForm.Left =
(Screen.PrimaryScreen.WorkingArea.Width - CallingForm.Width) / 2
CallingForm.show()
CallingForm = Nothing
Else
'edit action has taken place and therefore the window
F2 doesn't exist.
Dim frm As frmF2 = New frmF2(item)
frm.Show()
End If

OK button:
Me.Close()
If Not IsNothing(CallingForm) Then
CallingForm.close()
CallingForm = Nothing
End If

THE PROBLEM :
This is the situation at this moment (after a day hacking). The problem
is as follows: when someone pushes the edit button in the F1 form the
form F3 is called. When the NEW button is pressed in F3 F2 is called.
But due to the showdialogs and shows, execution continues in F1 and
popups in the foreground and F3 is pushed to the back. But when i use
the showdialogs errors occurs because of a circular reference F2 calls
F3, F3 calls F2, etc. Execution of code is continued after the
showdialog and therefore its not possible

So how to make sure that the F3 popups in the foreground?

Greetz,

Hennie

GhostInAK schreef:
 
B

Bruce Wood

Hennie7863 said:
I'm sorry ididn't reply earlier. I had to finish some other problems. I
have three windows F1, F2 and F3.

F1 = Treeview+listview screen
F2 = Selectionscreen(with 3 options)
F3 = Edit screen with a New button. New calls F2 again

F1 can call F2 (new)
F1 can call F3 (edit an entry)
F2 can call F3 (a new entry)
F3 can call F2 (new is pressed)

The first important question to answer here is (for each of the above
cases), does "can call" mean "brings the given screen to the
foreground, or, if the screen isn't showing, creates a new one," or
does it mean, "creates as new copy of the given screen and displays
it"?

This makes a big difference as to how you implement the forms. You need
to first define exactly what will happen when the user presses each
button, since "showing screen XX" is too vague and can mean either one
of the two things mentioned above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top