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

Conteo Usando Fornext While Do

The document describes code for a program that uses FOR/NEXT loops, WHILE loops, and DO loops to populate listboxes and calculate totals. The code adds numbers to listboxes using different loop types, calculates totals, and has buttons to execute, clear, and exit the program.

Uploaded by

Angel Arias
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Conteo Usando Fornext While Do

The document describes code for a program that uses FOR/NEXT loops, WHILE loops, and DO loops to populate listboxes and calculate totals. The code adds numbers to listboxes using different loop types, calculates totals, and has buttons to execute, clear, and exit the program.

Uploaded by

Angel Arias
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

FOR/NEXT WHILE DO

(Listbox1) (Listbox2) (Listbox3) Botton1

1 300 1 Ejecutar

Botton2

Impares Conteo Normal Pares Limpiar


(Descendente)
Botton3

200 400 Salir


1

Textbox1 Texbox2 Texbox3

Texbox4

Total

Public Class listadecontador

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


System.EventArgs) Handles TextBox2.TextChanged

End Sub

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


System.EventArgs) Handles TextBox4.TextChanged

End Sub

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


System.EventArgs) Handles Label1.Click

End Sub

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


System.EventArgs) Handles Button1.Click

Dim A, B, C As Integer
A = 1
B = 200
C = A + B
For A = 1 To 200 Step 2
ListBox1.Items.Add(Str(A))
B = B + A
C = C + B
Next

TextBox1.Text = (Str(C))

Dim contador1, contador2, contador3 As Integer


contador1 = 1
contador2 = 300
contador3 = contador1 + contador2
While contador2 >= 1
ListBox2.Items.Add(Str(contador2))
contador2 = contador2 - 1
contador3 = contador3 + contador2
End While

TextBox2.Text = (Str(contador3))

Dim cont, cont2, cont3 As Integer


cont = 2
cont2 = 400
cont3 = cont + cont2
Do Until cont = 400
ListBox3.Items.Add(Str(cont))
cont = cont + 2
cont3 = cont3 + cont2
Loop

TextBox3.Text = Str(cont3)

Dim total1, total2, total3, resultado As Integer

total1 = TextBox1.Text
total2 = TextBox2.Text
total3 = TextBox3.Text
resultado = total1 + total2 + total3
TextBox4.Text = Str(resultado)

End Sub

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


As System.EventArgs) Handles ListBox1.SelectedIndexChanged

End Sub

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


System.EventArgs) Handles TextBox1.TextChanged

End Sub

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


System.EventArgs) Handles TextBox3.TextChanged

End Sub

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


System.EventArgs) Handles Button2.Click

ListBox1.Items.Clear()
TextBox1.Clear()

ListBox2.Items.Clear()
TextBox2.Clear()

ListBox3.Items.Clear()
TextBox3.Clear()

TextBox4.Clear()

End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click

End

End Sub
End class

You might also like