giovaniluigi
Member
- Joined
- Jan 9, 2011
- Messages
- 16
- Programming Experience
- 5-10
I'm using .NET compact framework and I want to do a function or sub to manage the forms of my application.
The idea is to replace, for example, the code below:
Inside FormA:
The code above is called from FormA to load FormB
While FormB is loaded, FormA is disabled to prevent user to interact with it,
The frmWait is displayed to show to user a bitmap for example to be patient...
(frmWait is already loaded in memory, so it should be displayed without delay. I loaded it in Main.vb)
While FormB is loaded into memory (which takes 5 seconds) frmWait is on top and being displayed.
When FormB is loaded it is displayed and frmWait is hided.
Well this is needed because I'm running in a slow ARM CPU with WinCE 6 forms with a lot of controls on them.
The problem is that I have a lot of forms in my project.
I want to manage all this from a function/sub inside Main.vb
This way I will avoid to write the same code a lot of times...
Also I will have an elegant way to manage them.
I want that function or sub do something like:
The code should be something like that:
The main problem that I can see here is:
How to tell to the function what form to load ? I mean, how to pass a form type as a parameter ?
How to change application to run from FormB after closing FormA ? I think that Application.Run(f) may be not the right thing...
These are my questions. Remembering that this is inside Main.vb the StartUp point of my project.
The idea is to replace, for example, the code below:
Inside FormA:
VB.NET:
FormA.Enabled = False
frmWait.show()
frmWait.TopMost = True
Dim f as new FormB
f.show()
f.TopMost = True
frmWait.hide()
Me.close
The code above is called from FormA to load FormB
While FormB is loaded, FormA is disabled to prevent user to interact with it,
The frmWait is displayed to show to user a bitmap for example to be patient...
(frmWait is already loaded in memory, so it should be displayed without delay. I loaded it in Main.vb)
While FormB is loaded into memory (which takes 5 seconds) frmWait is on top and being displayed.
When FormB is loaded it is displayed and frmWait is hided.
Well this is needed because I'm running in a slow ARM CPU with WinCE 6 forms with a lot of controls on them.
The problem is that I have a lot of forms in my project.
I want to manage all this from a function/sub inside Main.vb
This way I will avoid to write the same code a lot of times...
Also I will have an elegant way to manage them.
I want that function or sub do something like:
Called from FormA, passing FormB class to create an instance and continue from it:
It should block user interaction with FormA
It should display frmWait
It should load FormB
It should display FormB
FormB should be displayed as TopMost
It should close FormA
The application now should continue to run on FormB.
It should block user interaction with FormA
It should display frmWait
It should load FormB
It should display FormB
FormB should be displayed as TopMost
It should close FormA
The application now should continue to run on FormB.
The code should be something like that:
VB.NET:
Public Sub GoToForm( ByRef MyForm as Form, ByRef NewForm as Form )
[INDENT]
MyForm.Enabled = False
frmWait.Show()
MyForm.Close()
Dim f As New NewForm
f.Show()
f.TopMost = True
Application.Run(f)
[/INDENT]
End Sub
The main problem that I can see here is:
How to tell to the function what form to load ? I mean, how to pass a form type as a parameter ?
How to change application to run from FormB after closing FormA ? I think that Application.Run(f) may be not the right thing...
These are my questions. Remembering that this is inside Main.vb the StartUp point of my project.