0% found this document useful (0 votes)
25 views

Deber de Programacion Visual 2

The document describes code for a program with the following functionality: 1) A class called "mes" that takes a number as input and returns the corresponding month name as a string. 2) A form with two buttons - one to populate a list box with numbers from 1 to 10, and another to clear the list box. 3) Another form with buttons to populate a list box with numbers from 0 to 100 incrementing by 10, and another to clear the list box.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Deber de Programacion Visual 2

The document describes code for a program with the following functionality: 1) A class called "mes" that takes a number as input and returns the corresponding month name as a string. 2) A form with two buttons - one to populate a list box with numbers from 1 to 10, and another to clear the list box. 3) Another form with buttons to populate a list box with numbers from 0 to 100 incrementing by 10, and another to clear the list box.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Diseo

Botones Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim valor As Integer valor = CInt(Me.TextBox1.Text) Dim sencase As mes = New mes(valor) MsgBox("Resultado: " + sencase.nombreMes(valor)) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.TextBox1.Text = "" Me.TextBox1.Focus() End Sub End Class Clase Public Class mes Private meses As Integer Public Sub New(ByVal pmeses As Integer) Me.meses = pmeses End Sub Function nombreMes(ByVal numeroMes As Integer) As String Dim mesSeleccionado As String = String.Empty Select Case numeroMes Case 1 mesSeleccionado = "Enero" Case 2 mesSeleccionado = "Febrero" Case 3 mesSeleccionado = "Marzo" Case 4 mesSeleccionado = "Abril" Case 5 mesSeleccionado = "Mayo" Case 6 mesSeleccionado = "Junio" Case 7 mesSeleccionado = "Julio" Case 8 mesSeleccionado = "Agosto" Case 9 mesSeleccionado = "Septiembre" Case 10 mesSeleccionado = "Octubre" Case 11 mesSeleccionado = "Noviembre" Case 12 mesSeleccionado = "Diciembre" End Select Return mesSeleccionado End Function End Class

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer For i = 1 To 10 ListBox1.Items.Add("Nmero: " + Str(i)) Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.ListBox1.Text = "" End Sub End Class

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer = 0 While i < 100 i += 10 ListBox1.Items.Add("Nmero: " + Str(i)) End While End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.ListBox1.Text = "" End Sub End Class

You might also like