HACER LOS PROYECTOS DEL CAPÍTULO 3 DEL LIBRO DE PELLAND, PATRICE: MICROSOFT VISUAL BASIC 2005 EXPRESS EDITION.SUBIR USANDO EL BOTON DE EXAMINAR

0

PARA CODIFICAR UNA APLICACIÓN EN CONSOLA

 

Module Module1

 

    Sub Main()

        ' Declaring two integer numbers variables that will hold the 2 parts

        ' of the sum and one integer variable to hold the sum

        Dim number1, number2, sum As Integer

        ' Assigning two values to the integer variables

        number1 = 10

        number2 = 5

        ' Adding the two integers and storing the result in the sum variable

        sum = number1 + number2

        'Displaying a string with the 2 numbers and the result.

        Console.WriteLine(“The sum of “ & number1.ToString() & “ and “ & number2.

            ToString() & “ is “ + sum.ToString())

        Console.ReadLine()

 

    End Sub

 



End Module

PARA CODIFICAR UNA APLICACIÓN EN WINDOWS

 

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        ' Declaring two integer numbers variables that will hold the 2 parts

        ' of the sum and one integer variable to hold the sum

        Dim number1, number2, sum As Integer

        ' Assigning two values to the integer variables

        number1 = 10

        number2 = 5

        ' Adding the two integers and storing the result in the sum variable

        sum = number1 + number2

        'Displaying a string with the 2 numbers and the result.

        MessageBox.Show(“The sum of “ & number1.ToString() & “ and “ & number2.

            ToString() & “ is “ + sum.ToString())

 

 

    End Sub

End Class






Tal vez te interesen estas entradas

No hay comentarios