Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Forums
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Re: Forums
Versions des environnements
Environment:
VB 8.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01270346
Message ID:
01270361
Vues:
24
i asked a question and in this site i had no anwer
I copied a coce from a publiction in viusal basic net i guess it is in 2003 and it does not work I have .net 2005 . I had a error message that say something like this
" Error attempting to exsute this project the file or assmebly could not be loaded neither one of their dependencies.The name of hte assembly or base code is not valid"
Try to help me please if not recommend me one site wehre i can find some help
the code is the following:
Public Class frmMenuEjecucion
    Inherits System.Windows.Forms.Form

#Region " Código generado por el Diseñador de Windows Forms "

    Public Sub New()
        MyBase.New()

        'El Diseñador de Windows Forms requiere esta llamada.
        InitializeComponent()

        'Agregar cualquier inicialización después de la llamada a InitializeComponent()

    End Sub

    'Form reemplaza a Dispose para limpiar la lista de componentes.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Requerido por el Diseñador de Windows Forms
    Private components As System.ComponentModel.IContainer

    'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
    'Puede modificarse utilizando el Diseñador de Windows Forms. 
    'No lo modifique con el editor de código.
    Friend WithEvents btnAgrega As System.Windows.Forms.Button
    Friend WithEvents btnNuevo As System.Windows.Forms.Button
    Friend WithEvents btnClonar As System.Windows.Forms.Button
    Friend WithEvents btnElimina As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.btnAgrega = New System.Windows.Forms.Button
        Me.btnNuevo = New System.Windows.Forms.Button
        Me.btnElimina = New System.Windows.Forms.Button
        Me.btnClonar = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'btnAgrega
        '
        Me.btnAgrega.Location = New System.Drawing.Point(40, 216)
        Me.btnAgrega.Name = "btnAgrega"
        Me.btnAgrega.Size = New System.Drawing.Size(120, 23)
        Me.btnAgrega.TabIndex = 0
        Me.btnAgrega.Text = "&Agrega Menu"
        '
        'btnNuevo
        '
        Me.btnNuevo.Location = New System.Drawing.Point(208, 216)
        Me.btnNuevo.Name = "btnNuevo"
        Me.btnNuevo.Size = New System.Drawing.Size(120, 23)
        Me.btnNuevo.TabIndex = 1
        Me.btnNuevo.Text = "&Nuevo Elemento"
        '
        'btnElimina
        '
        Me.btnElimina.Location = New System.Drawing.Point(376, 216)
        Me.btnElimina.Name = "btnElimina"
        Me.btnElimina.Size = New System.Drawing.Size(120, 23)
        Me.btnElimina.TabIndex = 2
        Me.btnElimina.Text = "&Elimina Elemento"
        '
        'btnClonar
        '
        Me.btnClonar.Location = New System.Drawing.Point(208, 134)
        Me.btnClonar.Name = "btnClonar"
        Me.btnClonar.Size = New System.Drawing.Size(120, 23)
        Me.btnClonar.TabIndex = 3
        Me.btnClonar.Text = "&Copia Menu"
        Me.btnClonar.UseVisualStyleBackColor = True
        '
        'frmMenuEjecucion
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(520, 273)
        Me.Controls.Add(Me.btnClonar)
        Me.Controls.Add(Me.btnElimina)
        Me.Controls.Add(Me.btnNuevo)
        Me.Controls.Add(Me.btnAgrega)
        Me.Name = "frmMenuEjecucion"
        Me.Text = "Demo Menú"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub btnAgrega_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAgrega.Click
        'Definiendo nuevo menu
        Dim NuevoMenu As New MainMenu()
        'Definiendo elementos del MainMenu
        Dim ElementoUno As New MenuItem("&Archivo")
        Dim ElementoDos As New MenuItem("A&yuda")

        'Asignando subelementos a las opciones del MainMenu
        Dim Opcion1 As New MenuItem("Salir")
        Dim Opcion2 As New MenuItem("Mensaje")
        'Estableciendo el procedimientoa ejecutarse al hacer click
        AddHandler Opcion1.Click, AddressOf Me.Opcion1_Click
        AddHandler Opcion2.Click, AddressOf Me.Opcion2_Click

        'Asignando Opcion1 a Elemento Uno 
        ElementoUno.MenuItems.Add(Opcion1)

        'Asignando Opcion2 a Elemento Dos
        ElementoDos.MenuItems.Add(Opcion2)

        'Asignando Elementos al MainMenu
        NuevoMenu.MenuItems.Add(ElementoUno)
        NuevoMenu.MenuItems.Add(ElementoDos)

        'Asignando NuevoMenu al formulario
        Me.Menu = NuevoMenu

    End Sub

    Private Sub btnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNuevo.Click
        'Creando un nuevo elemento
        Dim NuevaOpcion As New MenuItem("Abrir")

        'Asignando MenuItem al NuevoMenu
        Me.Menu.MenuItems(0).MenuItems.Add(NuevaOpcion)

    End Sub

    Private Sub btnElimina_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnElimina.Click
        Me.Menu.MenuItems(0).MenuItems.RemoveAt(1)
    End Sub

    Private Sub Opcion1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Close()
    End Sub
    Private Sub Opcion2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        MsgBox("Este es un mensaje de prueba")
    End Sub

    Private Sub btnClonar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClonar.Click
        Dim MenuContextual As ContextMenu
        MenuContextual = New ContextMenu()
        MenuContextual.MenuItems.Add(Me.Menu.MenuItems(1).CloneMenu())
        btnClonar.ContextMenu = MenuContextual
    End Sub
End Class
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform