Search KB Filter article types
Button CodeSample - With ContextMenu
Categories: Buttons and LinkLabels, Menus
Tags: Developers, Navigation, 1. Beginner, 2. Intermediate, 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 code sample shows a simple Button control with a ContextMenu

VB.NET code
Imports Gizmox.WebGui.Forms
 
Public Class Form2
    Friend WithEvents ContextMenu1 As Gizmox.WebGui.Forms.ContextMenu
    Friend WithEvents MenuItem1 As Gizmox.WebGui.Forms.MenuItem
    Friend WithEvents MenuItem2 As Gizmox.WebGui.Forms.MenuItem
    Friend WithEvents Button1 As Gizmox.WebGui.Forms.Button
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.ContextMenu1 = New Gizmox.WebGui.Forms.ContextMenu
        Me.MenuItem1 = New Gizmox.WebGui.Forms.MenuItem
        Me.MenuItem2 = New Gizmox.WebGui.Forms.MenuItem
 
        Me.MenuItem1.Index = 0
        Me.MenuItem1.Text = "Do This"
        Me.MenuItem1.Tag = "This"
 
        Me.MenuItem2.Index = 1
        Me.MenuItem2.Text = "Do That"
        Me.MenuItem2.Tag = "That"
 
        Me.ContextMenu1.MenuItems.AddRange(New Gizmox.WebGui.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem2})
 
        Me.Button1 = New Gizmox.WebGui.Forms.Button
        Me.Button1.Size = New System.Drawing.Point(100, 100)
        Me.Button1.Text = "Right Click Form Menu"
        Me.Button1.ContextMenu = Me.ContextMenu1
 
        Me.Controls.Add(Me.Button1)
    End Sub
 
    Private Sub Button1_MenuClick(ByVal objSource As System.Object, _
                                  ByVal objArgs As Gizmox.WebGui.Forms.MenuItemEventArgs) _
                                  Handles Button1.MenuClick
        If objArgs.MenuItem.Tag = "This" Then
            MessageBox.Show("Performing this")
        Else
            MessageBox.Show("Performing that")
        End If
    End Sub
 
End Class

C# Code
This part of the article has not been completed yet.

About the author

Related Articles

Buttons and LinkLabels  
Title Update Author
This video demonstrates how to open links in Visual WebGui.
Tags: Developers, Navigation, 1. Beginner, Navigation, Pre v6.3, v6.3, v6.4 and Later, 2. Intermediate, 3. Advanced
01/Jan/2009    2009/01/01
This video demonstrates how to open links in Visual WebGui.
Tags: Developers, Navigation, 1. Beginner, Navigation, Pre v6.3, v6.3, v6.4 and Later, 2. Intermediate, 3. Advanced
11/Jan/2007    2007/01/11
Tags: Architects, Developers, 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, 1. Beginner, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
21/July/2010    2010/07/21
Tags: Architects, Developers, Navigation, 1. Beginner, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
04/Dec/2010    2010/12/04
Tags: Developers, Navigation, 1. Beginner, 2. Intermediate, 3. Advanced, Navigation, Pre v6.3, v6.3, v6.4 and Later
23/July/2010    2010/07/23
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS