ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Aplicacion De La Burbuja Web


Enviado por   •  2 de Abril de 2013  •  248 Palabras (1 Páginas)  •  285 Visitas

Partial Public Class _Default

Inherits System.Web.UI.Page

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

If TextBox1.Text = "" Then

MsgBox("Debe ingresar un numero", 4404, "Datos incompletos")

Else

ListBox1.Items.Add(TextBox1.Text)

TextBox1.Text = ""

TextBox1.Focus()

End If

Dim numero As Integer

numero = ListBox1.Items.Count

If numero >= 2 Then

Button4.Enabled = True

Button5.Enabled = True

End If

End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click

If ListBox1.Items.Count = 0 Then

MsgBox("No hay elementos", 16, "Datos incompletos")

Else

ListBox1.Items.Clear()

Button4.Enabled = False

Button5.Enabled = False

End If

End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click

If ListBox1.Items.IndexOf(ListBox1.SelectedItem) <> -1 Then

ListBox1.Items.RemoveAt(ListBox1.Items.IndexOf(ListBox1.SelectedItem))

Else

MsgBox("selecciona un elemento", 16, "Datos incompletos")

End If

End Sub

Protected Sub Button4_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button4.Click

Dim vector() As Integer

Dim aux As Integer

ReDim vector(ListBox1.Items.Count - 1)

For i = 0 To ListBox1.Items.Count - 1

vector(i) = ListBox1.Items.Item(i).Text

Next

For i = 1 To vector.Length - 1

For j = 0 To vector.Length - i - 1

If vector(j) > vector(j + 1) Then

aux = vector(j)

vector(j) = vector(j + 1)

vector(j + 1) = aux

End If

Next j

Next i

For i = 0 To ListBox1.Items.Count - 1

ListBox1.Items.Item(i).Text = vector(i)

Next

End Sub

Protected Sub Button5_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button5.Click

Dim vector() As Integer

Dim aux As Integer

ReDim vector(ListBox1.Items.Count - 1)

For i = 0 To ListBox1.Items.Count - 1

vector(i) = ListBox1.Items.Item(i).Text

Next

...

Descargar como (para miembros actualizados) txt (2 Kb)
Leer 1 página más »
Disponible sólo en Clubensayos.com