| | | 
Advanced StrataFrame User
       
Group: StrataFrame Users Last Login: Today @ 11:04:43 AM Posts: 809, Visits: 11,679 |
| | Hi guys. Right, created the database in SQL, the SF application, the BOs for the tables, the SFMaintenanceForms for them, and now the SFappMainForm. Look, all of this new for me. I'm wandering what code to use in the SFMainForm menu strip item to call the forms. Will I use a SF method for this ? Not using the ToolStrip yet ... Thanks in advance. Ivan |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 11:24:42 AM Posts: 2,686, Visits: 1,889 |
| Hehe, no problem, Ivan... it can get pretty complex just showing the forms (which at first seems like something simple). Here's some generic code we use within our forms to show the child (MDI) forms.
'''
''' Show a form
'''
'''
'''
Public Sub ShowForm(ByVal FormType As System.Type)
Me.ShowForm(FormType, Nothing)
End Sub
'''
''' Show a form
'''
'''
'''
Public Sub ShowForm(ByVal FormType As System.Type, ByVal ParamArray Parameters() As Object)
'-- Establish Locals
Dim loForm As Object
Dim llFound As Boolean
'-- Make sure the form is not currently open
For Each loForm In Me.MdiChildren
If loForm.GetType() Is FormType Then
'-- The form is already shown, so just activate it
CType(loForm, Form).Activate()
llFound = True
End If
Next
If Not llFound Then
If Parameters Is Nothing Then
loForm = Activator.CreateInstance(FormType)
Else
loForm = Activator.CreateInstance(FormType, Parameters)
End If
With CType(loForm, MicroFour.StrataFrame.UI.Windows.Forms.BaseForm)
.MdiParent = Me
.Show()
End With
End If
End Sub
Say you have a child form called Form2, then to show it, you would call ShowForm(GetType(Form2)). If you need to pass parameters to the constructor, that's what the second overload is for.
Lemme know if you need this in C#... I can't remember your language (I know it's Portuguese, but I'm talking C#/VB )
www.bungie.net |
| | | | 
Advanced StrataFrame User
       
Group: StrataFrame Users Last Login: Today @ 11:04:43 AM Posts: 809, Visits: 11,679 |
| Thanks for the help Ben. Well, to be honest, is there a "sign language" in .NET ? |
| | | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 07/09/2008 2:20:16 PM Posts: 436, Visits: 944 |
| | Where would the code Ben supplied go? In the MDI Parent form or in each of the children? |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 11:24:42 AM Posts: 2,686, Visits: 1,889 |
| That code goes in the MDI parent, not the children. So, you can easily show the child forms without having to copy the code to each of them.
www.bungie.net |
| | | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 07/09/2008 2:20:16 PM Posts: 436, Visits: 944 |
| Would you guys happen to have an MDI sample in VB .NET that I could download and inspect? I guess I want to use as much of your framework as possible and utilize all the power it contains. I want to avoid doing things the "long" way or the "hard" way. |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 11:24:42 AM Posts: 2,686, Visits: 1,889 |
| That code (or something very similar to it) should be in the StrataFrame VB.NET sample within your program files. In the MainForm.vb file, is the MDI form where you should find the code.
www.bungie.net |
| |
|
|