Search KB Filter article types
Form Concepts CodeSample - Simulating IFRAMEs
Categories: Forms, UserControls Switching
Tags: Developers, Navigation, 1. Beginner, 2. Intermediate, Navigation, Pre v6.3, v6.3, v6.4 and Later, 3. Advanced
Revision: 1
Posted: 20/Sep/2009
Updated: 23/July/2010
Status: Publish
Types: Code

This article will have a few sections added to it soon, based on the following article type skeleton: CodeSample
Overview

This article is a part of Form Concepts series of articles.

The codesample shows how you use a single Panel and ToolBar for navigation and for each option selected, dynamically creating the corresponding UserControl and replacing the contents within the Panel.

This method for navigation is one of two similar ones where you use dynamically created UserControls instead of Forms. The other method can be found in UserControls on Tabs.

Background

This sample is based on the video tutorial presented in the Video references section in Form Concepts. Pay special attention to View3Control, as in that control contents are loaded dynamically and only when the control is requested by the toolbar buttons. For big applications with a lot of views, this means that users are unlikely to visit all the views in any one session, and only when that view is requestes, the data is loaded. This can save a lot of loading time and resources for those big applications.

The code for the UserControls is not included here, and you should view the video to see it.

VB.NET Code
Imports Gizmox.WebGui.Forms
Public Class IFRAMESform
    Friend WithEvents ToolBar1 As Gizmox.WebGui.Forms.ToolBar
    Friend WithEvents Panel1 As Gizmox.WebGui.Forms.Panel
    Friend WithEvents ToolBarButton1 As Gizmox.WebGui.Forms.ToolBarButton
    Friend WithEvents ToolBarButton2 As Gizmox.WebGui.Forms.ToolBarButton
    Friend WithEvents ToolBarButton3 As Gizmox.WebGui.Forms.ToolBarButton
 
    Sub New()
 
        ' This call is required by the Windows Form Designer.
        InitializeComponent()
 
        ' Add any initialization after the InitializeComponent() call.
        Me.ToolBar1 = New Gizmox.WebGui.Forms.ToolBar
        Me.Panel1 = New Gizmox.WebGui.Forms.Panel
        Me.ToolBarButton1 = New Gizmox.WebGui.Forms.ToolBarButton
        Me.ToolBarButton2 = New Gizmox.WebGui.Forms.ToolBarButton
        Me.ToolBarButton3 = New Gizmox.WebGui.Forms.ToolBarButton
        '
        'ToolBar1
        '
        Me.ToolBar1.Anchor = Gizmox.WebGui.Forms.AnchorStyles.None
        Me.ToolBar1.Appearance = Gizmox.WebGui.Forms.ToolBarAppearance.Normal
        Me.ToolBar1.Buttons.AddRange(New Gizmox.WebGui.Forms.ToolBarButton() {Me.ToolBarButton1, Me.ToolBarButton2, Me.ToolBarButton3})
        Me.ToolBar1.Dock = Gizmox.WebGui.Forms.DockStyle.Top
        Me.ToolBar1.DragHandle = True
        Me.ToolBar1.DropDownArrows = False
        Me.ToolBar1.ImageList = Nothing
        Me.ToolBar1.Location = New System.Drawing.Point(0, 0)
        Me.ToolBar1.MenuHandle = True
        Me.ToolBar1.Name = "ToolBar1"
        Me.ToolBar1.RightToLeft = False
        Me.ToolBar1.ShowToolTips = True
        Me.ToolBar1.TabIndex = 0
        '
        'Panel1
        '
        Me.Panel1.Anchor = Gizmox.WebGui.Forms.AnchorStyles.None
        Me.Panel1.BorderStyle = Gizmox.WebGui.Forms.BorderStyle.Clear
        Me.Panel1.Dock = Gizmox.WebGui.Forms.DockStyle.Fill
        Me.Panel1.Location = New System.Drawing.Point(0, 28)
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Size = New System.Drawing.Size(690, 478)
        Me.Panel1.TabIndex = 1
        '
        'ToolBarButton1
        '
        Me.ToolBarButton1.CustomStyle = ""
        Me.ToolBarButton1.Name = "ToolBarButton1"
        Me.ToolBarButton1.Pushed = True
        Me.ToolBarButton1.Size = 24
        Me.ToolBarButton1.Tag = "View1"
        Me.ToolBarButton1.Text = "View1"
        Me.ToolBarButton1.ToolTipText = ""
        '
        'ToolBarButton2
        '
        Me.ToolBarButton2.CustomStyle = ""
        Me.ToolBarButton2.Name = "ToolBarButton2"
        Me.ToolBarButton2.Pushed = True
        Me.ToolBarButton2.Size = 24
        Me.ToolBarButton2.Tag = "View2"
        Me.ToolBarButton2.Text = "View2"
        Me.ToolBarButton2.ToolTipText = ""
        '
        'ToolBarButton3
        '
        Me.ToolBarButton3.CustomStyle = ""
        Me.ToolBarButton3.Name = "ToolBarButton3"
        Me.ToolBarButton3.Pushed = True
        Me.ToolBarButton3.Size = 24
        Me.ToolBarButton3.Tag = "View3"
        Me.ToolBarButton3.Text = "View3"
        Me.ToolBarButton3.ToolTipText = ""
        '
        'IFRAMESform
        '
        Me.Controls.Add(Me.Panel1)
        Me.Controls.Add(Me.ToolBar1)
        Me.Size = New System.Drawing.Size(690, 506)
        Me.Text = "IFRAMESform"
 
    End Sub
    Private Sub ToolBar1_Click(ByVal objSource As System.Object, ByVal objArgs As Gizmox.WebGui.Forms.ToolBarItemEventArgs) Handles ToolBar1.Click
        Dim objControl As Control = Nothing
        If objArgs.ToolBarButton.Tag = "View1" Then
            objControl = New View1Control
        ElseIf objArgs.ToolBarButton.Tag = "View2" Then
            objControl = New View2Control
        ElseIf objArgs.ToolBarButton.Tag = "View3" Then
            objControl = New View3control
        End If
        If objControl IsNot Nothing Then
            Panel1.Controls.Clear()
            Panel1.Controls.Add(objControl)
        End If
    End Sub
End Class

C# Code
The conversion of this code to C# has not been completed yet.

About the author

Related Articles

Forms  
Title Update Author
Tags: Developers, Windows & Dialogs, C#, XML, 1. Beginner, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
11/Jan/2007    2007/01/11
Tags: Architects, Developers, Windows & Dialogs, 1. Beginner, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
04/Dec/2010    2010/12/04
Tags: Developers, Theme, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
23/July/2010    2010/07/23
Tags: Developers, Events, Navigation, 1. Beginner, 2. Intermediate, Pre v6.3, v6.3, v6.4 and Later, 3. Advanced
04/Dec/2010    2010/12/04
Tags: Architects, Developers, Windows & Dialogs, 1. Beginner, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
04/Dec/2010    2010/12/04
Tags: Architects, Developers, Navigation, Windows & Dialogs, 1. Beginner, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
24/May/2010    2010/05/24
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS