jueves, 23 de octubre de 2008

kevin


Realizaremos un formulario de análisis numérico:

1)4 frames

2)En el primer frame colocarás 1 label y 1 cuadro de texto, en el segundo frame le colocaremos el nombre de Divisores y un cuadro de texto , en el tercer frame colocaremos 6 label y en el cuarto frame colocaremos 3 comandos

3)Propiedades:

Label1:

Caption:Introduce un número

Label2:

Caption:Número de digitos

Label3:
Caption:Suma de dígitos ¡mpares

Label4:
Caption:Suma de dígitos pares

Label5:
Caption:Suma total de dígitos

Label6:
Caption:Dígito mayor

Label7:

Caption:Dígito menor

A los cuadros de texto le boremos el contenido de la propiedad Text

Command1:

Caption:Análisis

Código:
If IsNumeric(Text1) Then
Dim s As Integer, si As Integer, sp As Integer
Dim may As Integer, min As Integer
Dim cad As String
Dim i As Integer, j As Integer
n = CLng(Text1)
m = CLng(Text1)
cad = ""
i = 0
j = 1
s = sp = si = 0
For j = 1 To n
If (n Mod j = 0) Then
cad = cad & j & vbCrLf
End If
Next j
While (n > 0)
If ((n Mod 10) Mod 2) = 0 Then
sp = sp + (n Mod 10)
Else
si = si + (n Mod 10)
End If
s = s + (n Mod 10)
n = n \ 10
i = i + 1
Wend
may = Mid(Text1, 1, 1)
men = may
While (m > o)
If may < (m Mod 10) Then may = m Mod 10End IfIf men > (m Mod 10) Thenmen = m Mod 10
End If
m = m \ 10
Wend
Text2 = Str(i)
Text3 = Str(si)
Text4 = Str(sp)
Text5 = Str(s)
Text6 = Str(may)
Text7 = Str(men)
Text8 = cad
Else
MsgBox "Debes Introducir un Número, El que Quieras pero Introduce Un Número", vbCritical,
"Aviso Importante"
Text1.SetFocus
End If

Command2:
Caption:Otro Núméro

Código:Text1 = "": Text2 = ""
Text3 = "": Text4 = ""
Text5 = "": Text6 = ""
Text7 = "": Text8 = ""
Text1.SetFocus
Command3:
Caption:Salir

Código:If MsgBox("¿Deseas Cerrar el Programa?", vbQuestion + vbYesNo, "Aviso Antes de Cerrar el Programa") = vbYes ThenEndElseCancel = TrueText1.SetFocusEnd If




Realizaremos un formulario de calificaciones:
1)Colocaremos en el formulario 10 labels, 9 cuadros de texto, 3 comandos
2)Propiedades:
Label1:
Caption:Alumno
Label2:
Caption:Prom. semestre1
Label3:
Caption:Prom. semestre2
Label4:
Caption:Prom. semestre3
Label5:
Caption:Prom. semestre4
Label6:
Caption:Prom. semestre5
Label7:
Caption:Prom. semestre6
Label8:
Caption:Comentario
Label9:
Caption:Un seudónimo tuyo
Código:Label10.Caption = "tu nombre"
A los cuadros de texto le borramos el contenido de la propiedad text
Command1:
Caption:Prom. Gral. Redondeado
Código:Dim n1 As Double, n2 As Double, n3 As Double, n4 As Double, n5 As Double, n6 As Double
Dim promedio As Integer
n1 = Val(Text2): n2 = Val(Text3)
n3 = Val(Text4): n4 = Val(Text5)
n5 = Val(Text6): n6 = Val(Text7)
promedio = ((n1 + n2 + n3 + n4 + n5 + n6) / 6)
Text8 = Str(promedio)If promedio >= 9.5 Then
Text9 = "Excelente"
End If
If promedio >= 9 And promedio <>
Text9 = "Muy Bien"End IfIf promedio >= 8.5 And promedio <>
Text9 = "Bien"
End If
If promedio >= 8 And promedio <>
Text9 = "Regular"
End If
If promedio <>
Text9 = "Mal"
End If

Command2:
Caption:Limpiar
Código:
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text1.SetFocus
Command3:
Caption:Salir
Código:Unload Me
End




Realizaremos un formulario de fecha escrita
1)Colocaremos en el formulario 4 labels y un quinto label dentro del frame, 3 cuadros de texto, 3 botones de comando y un frame
2)Propiedades:
A los cuadros de texto le borramos el contenido de la propiedad text
Label1:
Caption:Introduce los datos

Label2:
Caption:Día
Label3:
Caption:Mes
Label4:
Caption:Año

Frame1:
Caption:La fecha es

Command1:
Caption:Convertir

Código:

Dim cadmes As String,
mes As Integermes = Val(Text2)
Select Case mes
Case 1: cadmes = "Enero"
Case 2: cadmes = "Febrero"
Case 3: cadmes = "Marzo"
Case 4: cadmes = "Abril"
Case 5: cadmes = "Mayo"
Case 6: cadmes = "Junio"
Case 7: cadmes = "Julio"
Case 8: cadmes = "Agosto"
Case 9: cadmes = "Septiembre"
Case 10: cadmes = "Octubre"
Case 11: cadmes = "Noviembre"
Case 12: cadmes = "Diciembre"
Case Else
MsgBox "Revísalos Por Favor", vbCritical, "Hay un Error en los Datos...!!!"
Call Command2_Click
Exit Sub
End Select
Label5 = Text1 & " de " & cadmes & " de " & Text3ç

Command2:
Caption:Limpiar

Código:
Text1 = ""
Text2 = ""
Text3 = ""
Text1.SetFocus
Command3:
Caption:Salir

Código:If MsgBox("¿Ya Quieres Salir del Programa?", vbQuestion + vbYesNo, "Tengo una Pregunta para Ti") = vbYes Then
End
Else: Call
Command2_Click
End If




Realizaremos un formulario de impresora

1)Colocaremos en el formulario 6 labels, 6 cuadros de texto y 2 comandos

2)Propiedades:

Label1:
Caption:fecha
Label2:
Caption:nombre
Label3:
Caption:domicilio
Label4:
Caption:colonia
Label5:
Caption:estado
Label6:
Caption:teléfono

A los cuadros de texto le borramos el contenido de la propiedad text

Command1:
Caption:Limpiar

Código:
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text1.SetFocus

Command2:
Caption:Imprimir
Código:
Printer.Orientation = 1
Printer.FontSize = 12
Printer.Print
Printer.Print
Printer.Print
Printer.Print Tab(15); Label1.Caption; Tab(30);Text1.Text
Printer.Print
Printer.Print
Printer.Print Tab(15); Label2.Caption; Tab(30);Text2.Text
Printer.Print
Printer.Print
Printer.Print Tab(15); Label3.Caption; Tab(30); Text3.Text
Printer.Print
Printer.Print
Printer.Print Tab(15); Label4.Caption; Tab(30); Text4.Text
Printer.PrintPrinter.Print
Printer.Print Tab(15); Label5.Caption; Tab(30); Text5.Text
Printer.Print
Printer.Print
Printer.Print Tab(15); Label6.Caption; Tab(30); Text6.Text
Printer.EndDoc




Realizaremos un formulario de palíndromos

1)Colocaremos 3 labels, 2 cuadros de texto, 3 botones de comando.

2)Propiedades:

Label1:

Caption: Los palíndromos son palabras o frases que se leen al revés de la misma manera en que se leen regularmente.

Label2:
Caption:Introduce el texto

Label3:
Caption: Texto invertido

A los cuadros de texto le borramos el contenido de la propiedad text

Command1:

Caption:Invertir

Código:Text2 = cadinvertida(Text1)

Command2:
Caption:Limpiar

Código:

Text1 = ""

Text2 = ""

Text1.SetFocus

Command3:

Caption:Salir
Código:

Unload Me


























1 comentario:

  1. saludos, soy nuevo en esto y esta muy bien todo, solo tengo una pequeña duda cuando ejecuto el for del analisis me da un error en la letra n no se si puedes ayudarme....
    te lo agradecere mucho

    ResponderEliminar