Professional Documents
Culture Documents
Practica#22
12 noviembre 2010
Lista de Cotejo
Práctica # 22 Manejo de estructuras de repetición en ordenamiento
INSTRUCCIONES DE APLICACIÓN.
Verifique que se encuentren los componentes señalados abajo y marque con una √ el registro de
cumplimiento correspondiente.
REGISTRO DE
REGISTRO DE
a(0) = ListBox1.Items(0)
a(1) = ListBox1.Items(1)
a(2) = ListBox1.Items(2)
a(3) = ListBox1.Items(3)
a(4) = ListBox1.Items(4)
For x = 0 To 4
For y = 0 To 3
If (a(y) <= a(y + 1)) Then
temp = a(y)
a(y) = a(y + 1)
a(y + 1) = temp
End If
Next y
Next x
ListBox1.Items.Clear()
For x = 0 To 4
ListBox1.Items.Add(a(x))
Next x
End Sub
End Class
Fecha seleccionada
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Label1.Text = Str(ListBox1.SelectedItem)
Select Case Int(ListBox2.SelectedItem)
Case 1
Label1.Text = Label1.Text + " de enero de "
Case 2
Label1.Text = Label1.Text + " de febrero de "
Case 3
Label1.Text = Label1.Text + " de marzo de "
Case 4
Label1.Text = Label1.Text + " de abril de "
Case 5
Label1.Text = Label1.Text + " de mayo de "
Case 6
Label1.Text = Label1.Text + " de junio de "
Case 7
Label1.Text = Label1.Text + " de julio de "
Case 8
Label1.Text = Label1.Text + " de agosto de "
Case 9
Label1.Text = Label1.Text + " de septiembre de "
Case 10
Label1.Text = Label1.Text + " de octubre de "
Case 11
Label1.Text = Label1.Text + " de noviembre de "
Case 12
Label1.Text = Label1.Text + " de diciembre de "
End Select
Label1.Text = Label1.Text + Str(ListBox3.SelectedItem)
End Sub
Public Sub Actualiza()
ListBox1.Items.Add(Int(dt.Rows(fila)("D")))
ListBox2.Items.Add(Int(dt.Rows(fila)("M")))
ListBox3.Items.Add(Int(dt.Rows(fila)("A")))
End Sub
Consultar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
cn.open()
Dim mostrardatos As String = "Select * from Fechas"
Dim dataAdapter As New OleDb.OleDbDataAdapter(mostrardatos, cn)
dataAdapter.Fill(dt)
For fila = 0 To dt.Rows.Count - 1
Actualiza()
Next
dataAdapter.Dispose()
cn.Close()
End Sub
Ordenar
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
Dim a(6) As Integer
Dim x As Integer
Dim y As Integer
Dim temp As Integer
a(0) = ListBox1.Items(0)
a(1) = ListBox1.Items(1)
a(2) = ListBox1.Items(2)
a(3) = ListBox1.Items(3)
a(4) = ListBox1.Items(4)
a(5) = ListBox1.Items(5)
For x = 0 To 5
For y = 0 To 4
If (a(y) <= a(y + 1)) Then
temp = a(y)
a(y) = a(y + 1)
a(y + 1) = temp
End If
Next y
Next x
ListBox1.Items.Clear()
For x = 0 To 5
ListBox1.Items.Add(a(x))
Next x
a(0) = ListBox2.Items(0)
a(1) = ListBox2.Items(1)
a(2) = ListBox2.Items(2)
a(3) = ListBox2.Items(3)
a(4) = ListBox2.Items(4)
a(5) = ListBox2.Items(5)
For x = 0 To 5
For y = 0 To 4
If (a(y) <= a(y + 1)) Then
temp = a(y)
a(y) = a(y + 1)
a(y + 1) = temp
End If
Next y
Next x
ListBox2.Items.Clear()
For x = 0 To 5
ListBox2.Items.Add(a(x))
Next x
a(0) = ListBox3.Items(0)
a(1) = ListBox3.Items(1)
a(2) = ListBox3.Items(2)
a(3) = ListBox3.Items(3)
a(4) = ListBox3.Items(4)
a(5) = ListBox3.Items(5)
For x = 0 To 5
For y = 0 To 4
If (a(y) <= a(y + 1)) Then
temp = a(y)
a(y) = a(y + 1)
a(y + 1) = temp
End If
Next y
Next x
ListBox3.Items.Clear()
For x = 0 To 5
ListBox3.Items.Add(a(x))
Next x
End Sub
End Class