
Crea un formulario con tres marcos, una caja de texto, dos botones de opción, una caja de lista, cuatro botones y escribe el siguiente código:
Haz doble clic en el formulario y escribe:
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("¿Cerramos el Programa?", vbQuestion + vbYesNo, "¿Ya nos Vamos?") = vbYes Then
End
Else: Cancel = True: Text1.SetFocus
End If
End Sub
El botón Agregar
Private Sub Command1_Click()
If IsNumeric(Text1.Text) Then
List1.AddItem Text1.Text
Text1.Text = ""
Text1.SetFocus
Else
MsgBox "Introduce un Número", vbCritical, "Por Favor"
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.SetFocus
End If
End Sub
El botón Ordenar
Private Sub Command2_Click()
Dim i As Integer, j As Integer, t As Integer, n As Integer
Dim a() As Integer
n = List1.ListCount
ReDim a(n)
For i = 0 To n - 1
a(i) = List1.List(i)
Next i
If Option1.Value Then
For i = 0 To n - 2
For j = i + 1 To n - 1
If a(i) > a(j) Then
t = a(i)
a(i) = a(j)
a(j) = t
End If
Next j
Next i
End If
Text1.SetFocus
If Option2.Value Then
For i = 0 To n - 2
For j = i + 1 To n - 1
If a(i) < a(j) Then
t = a(i)
a(i) = a(j)
a(j) = t
End If
Next j
Next i
End If
List1.Clear
For i = 0 To n - 1
List1.List(i) = a(i)
Next i
Text1.SetFocus
End Sub
El botón Lista Nueva
Private Sub Command4_Click()
Text1 = ""
List1.Clear
Text1.SetFocus
End Sub
El botón Salir
Private Sub Command3_Click()
If MsgBox("¿Seguro que Quieres Cerrar el Programa?", vbQuestion + vbYesNo, "¿Ya es Hora de Irnos?") = vbYes Then
End
Else: Cancel = True: Text1.SetFocus
End If
End Sub
Hay 19 opiniones. Opina sobre este curso.
| Cursos | Valoración | Alumnos | Vídeo | |
|---|---|---|---|---|
|
Corel Draw 11 Básico Corel Draw es una potente herramienta que utilizan los diseñadores profesionales para crear, logotipos, esquemas, ilustraciones, dibujos, etc. No se asuste, para usted am... [10/05/05] |
|
11.974 | ||
|
Cómo convertir una fotocaricatura en un dibujo de tinta y acuarela Tal y como se han presentado otros cursos en Mailxmail de fotocaricatura, este vez se ofrece la posibilidad de conocer cómo convertir una fotocaricatura en un dibujo de t... [19/07/06] |
|
4.403 | ||
|
Cómo eliminar los ojos rojos con PhotoShop En esta práctica conoceremos los pasos necesarios para poder eliminar los ojos rojos de una fotografía.... [26/05/08] |
|
2.155 |
|
|
Publicar en
del.icio.us
digg
meneame