0% found this document useful (0 votes)
27 views2 pages

Public Class Dim As Integer Private Sub Byval As Byval As Handles Mybase

This document contains code for a program that counts even and odd numbers. It initializes counters for even and odd numbers to 0. When a number is entered, it checks if the number is even or odd using the modulo operator and increments the appropriate counter. The counters are displayed and the number input is reset after each number entry. A reset button is also included to restart the counters and inputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Public Class Dim As Integer Private Sub Byval As Byval As Handles Mybase

This document contains code for a program that counts even and odd numbers. It initializes counters for even and odd numbers to 0. When a number is entered, it checks if the number is even or odd using the modulo operator and increments the appropriate counter. The counters are displayed and the number input is reset after each number entry. A reset button is also included to restart the counters and inputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Public Class frmcontadordepareseimpares

'Declaracion de variables
Dim ContIM, ContPA, numero, i, n As Integer
Private Sub frmcontadordepareseimpares_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
'Inicializacion de variables
ContIM = 0
ContPA = 0
i = 1
End Sub

Private Sub btningresar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btningresar.Click
Dim numero As Integer
numero = Val(txtnumero.Text)
If numero > 0 Then
If (numero Mod 2 = 0) Then
ContPA += 1
Else
ContIM += 1
End If
txtpares.Text = ContPA
txtimpares.Text = ContIM
i += 1
End If
txtnumero.Text = ""
txtnumero.Focus()
End Sub

Private Sub btnreiniciar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnreiniciar.Click
btnreiniciar.Enabled = False
lblnumero.Text = "numero"
txtnumero.Text = ""
txtpares.Text = ""
txtimpares.Text = ""
ContPA = 0
ContIM = 0
i = 0
End Sub
End Class

You might also like