Está en la página 1de 8

Material de la Asignatura Programación 4to AI – Inst.

San Rafael 1
Marisa E. Conde .
Especialista en Informática Educativa – UBA-

1-Nombre y apellido
Ejercicio 1 Armar un formulario donde se deba ingresar
el apellido.
La respuesta deberá salir a través de una label donde
diga “Bienvenido”…..Esta es tu primera actividad”

Colocar los siguientes controles


1 Textbox
2 label
2 cmd

Programación
Private Sub cmdahora_Click()
lblmensaje.Caption = "Bienvenido " & txtnombre.Text & " Esta es tu primera actividad"
End Sub
-----------------------------------------------------
Private Sub cmdfin_Click()
End
End Sub

2-Colores

Option Explicit
Private Sub Form_Load()
txtCaja = 0
End Sub

Private Sub Option1_Click()


txtCaja.BackColor = vbGreen
End Sub

Private Sub Option2_Click()


txtCaja.BackColor = vbBlue
End Sub

Private Sub Option3_Click()


txtCaja.BackColor = vbYellow Colocar los siguientes controles
End Sub 4 Option Botton – 1 Text

Private Sub rojo_Click()


txtCaja.BackColor = vbRed
End Sub
Material de la Asignatura Programación 4to AI – Inst. San Rafael 2
Marisa E. Conde .
Especialista en Informática Educativa – UBA-

3-Balanza
Control Propiedad Valor
textbox Name txtpeso
Text
textbox Name txtalt
Text
textbox Name txtpeso
Text
Command Name: cmdresultado
Botton
Caption: resultado

Label Name: lblmensaje


Caption:

Private Sub cmdresultado_Click()


Dim peso, altura As Double
If IsNumeric(txtpeso) Then
peso = CDbl(txtpeso.Text)
Else
MsgBox "Ingrese un valor numérico"
End If
If IsNumeric(txtalt) Then
altura = CDbl(txtalt.Text)
Else
MsgBox "Ingrese un valor numérico > a 0"
End If
lblmensaje = peso / altura ^ 2 Colocar los siguientes controles
If lblmensaje < 25 Then 4 label – 2 text
MsgBox "Comé sin problemas"
ElseIf lblmensaje >= 30 Then
MsgBox "Suspendeme los postres"
Else
MsgBox "Hace dieta, gorrrrda"
End If
End Sub
Material de la Asignatura Programación 4to AI – Inst. San Rafael 3
Marisa E. Conde .
Especialista en Informática Educativa – UBA-

4-Edad
Control Propiedad Valor
1 textbox Name txtfecha
Text
1 textbox Name txtalt
Text
1 textbox Name txtpeso
Text
1 Command Name: cmdedad
Botton
Caption: resultado
1 Label Name: lblresultado
Caption:
1 Label Name: Lbl1
Caption Ingrese su nombre
1 Label Name: Lbl2
Caption: Ingrese su fecha de
nacimiento 00/00/00

Colocar los siguientes controles


3 label- 1 text – 1 Command
Button
Private Sub cmdedad_Click()
Dim b As Date, edad As Integer
b = CDate(txtfecha.Text)
edad = CInt(Year(Now) - Year(txtfecha))
lblresultado.Caption = txtnombre.Text & " " & "usted tiene" & " " & edad & "" & "años"
lblresultado.BackColor = vbMagenta
End Sub
----------------------------------------------------------------------------------------------------------

5-Ruleta

Private Sub cmdcalcular_Click()


Dim x As Integer, y As Integer
Randomize Timer
x = Rnd * 10
y = Rnd * 10
lblx.Caption = x
lbly.Caption = y
lblproducto = x - y
lblsumar = x + y
Colocar los siguientes controles
End Sub 6 label 1 command button

------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
6-Calculadora

Option Explicit
Private Sub cmdDiv_Click()
txtResult.Text = Val(txtOper1.Text) /
Val(txtOper2.Text)
lblOp.Caption = "/" Colocar los siguientes controles
3 text – 2 label – 4 command
End Sub
button
Material de la Asignatura Programación 4to AI – Inst. San Rafael 4
Marisa E. Conde .
Especialista en Informática Educativa – UBA-

Private Sub cmdProd_Click()


txtResult.Text = Val(txtOper1.Text) * Val(txtOper2.Text)
lblOp.Caption = "*"
End Sub

Private Sub cmdResta_Click()


txtResult.Text = Val(txtOper1.Text) - Val(txtOper2.Text)
lblOp.Caption = "-"
End Sub

Private Sub cmdSuma_Click()


txtResult.Text = Val(txtOper1.Text) + Val(txtOper2.Text)
lblOp.Caption = "+"
End Sub

-----------------------------------------------------------------------------------------------------------------------
7-Ordenar Numeros

Option Explicit
Dim n1, n2, n3 As Integer
Private Sub Command1_Click()
Label5.Caption = ""
Label6.Caption = ""
Label4.Caption = ""
Label1.Visible = True
Label2.Visible = True
Label3.Visible = True Colocar los siguientes controles
7 label 2command button. Las 3 sup
Call azar mod
End Sub

Private Sub azar()


n1 = Int(Rnd * 10) + 1
n2 = Int(Rnd * 10) + 1
n3 = Int(Rnd * 10) + 1
If n1 <> n2 And n2 <> n3 And n1 <> n3 Then
Label1.Caption = n1
Label2.Caption = n2
Label3.Caption = n3
Else
Exit Sub
End If
End Sub

Private Sub Command2_Click()


If Val(Label4.Caption) < Val(Label5.Caption) And Val(Label5.Caption) < Val(Label6.Caption)
Then
Label7.Caption = "Bien"
Else
Label7.Caption = "Mal"
End If
End Sub

Private Sub Form_Load()


Randomize
Call azar
End Sub
Material de la Asignatura Programación 4to AI – Inst. San Rafael 5
Marisa E. Conde .
Especialista en Informática Educativa – UBA-

Private Sub Label4_DragDrop(Source As Control, X As Single, Y As Single)


Label4.Caption = Source
Source.Visible = False
End Sub

Private Sub Label5_DragDrop(Source As Control, X As Single, Y As Single)


Label5.Caption = Source
Source.Visible = False
End Sub

Private Sub Label6_DragDrop(Source As Control, X As Single, Y As Single)


Label6.Caption = Source
Source.Visible = False
End Sub

-----------------------------------------------------------------------------------------------------------------------
8-Modificaciones en la fuente
Dim valor As Integer
Dim tipo As String
Private Sub Command1_Click()
Label1.FontBold = True
End Sub

Private Sub Command2_Click()


Label1.FontItalic = True
End Sub

Private Sub Command3_Click()


Label1.FontUnderline = True
End Sub
Colocar los siguientes controles
Private Sub Command4_Click()
Label1.FontStrikethru = True 1- label - 8 command button
End Sub

Private Sub Command5_Click()


On Error Resume Next
valor = InputBox("Introduzca el tamaño de la letra", "tamaño de la letra")
Label1.FontSize = valor
End Sub

Private Sub Command6_Click()


On Error Resume Next
tipo = InputBox("introduzca el tipo de letra", "tipo de letra")
Label1.FontName = tipo
End Sub

Private Sub Command7_Click()


Label1.FontBold = False
Label1.FontItalic = False
Label1.FontUnderline = False
Label1.FontStrikethru = False
Label1.FontSize = 10
End Sub

Private Sub Command8_Click()


Label1.FontItalic = True
Label1.FontUnderline = True
Label1.FontStrikethru = True
End Sub
Material de la Asignatura Programación 4to AI – Inst. San Rafael 6
Marisa E. Conde .
Especialista en Informática Educativa – UBA-

-----------------------------------------------------------------------------------------------------------------------

9-CARITA FELIZ

Private Sub Picture2_DragOver(Source As Control, X As Single, Y As Single, State As Integer)


Picture2.Visible = False
End Sub

Private Sub Picture3_DragOver(Source As Control, X As Single, Y As Single, State As Integer)


Picture1.Visible = True
End Sub

Colocar los siguientes controles


3 picture y una Label- Modif Propiedad de las
Pictures Drag Mode a Automatic

-----------------------------------------------------------------------------------------------------------------------
10-CARRITO DE COMPRA

Dim total As Integer


------
Private Sub Command1_Click()
Text1.Text = "" ' vaciámos la caja de texto.
total = 0 ' reiniciamos la variable a 0.
End Sub

Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)


If Source = Picture1 Then
Colocar los siguientes controles
total = total + 260 3 Picture 1 label 1 Text 1 Command Button Modif
ElseIf Source = Picture2 Then Propiedad de las Pictures Drag Mode a Automatic
total = total + 300
ElseIf Source = Picture3 Then
total = total + 1400
End If
Text1.Text = total
End Sub

Private Sub Picture2_DragDrop(Source As Control, X As Single, Y As Single)


If Source = Picture2 Then
total = total + 300
ElseIf Source = Picture1 Then
total = total + 260
ElseIf Source = Picture3 Then
total = total + 1400
End If
Text1.Text = total
End Sub

Private Sub Picture3_DragDrop(Source As Control, X As Single, Y As Single)


If Source = Picture3 Then
total = total + 1400
ElseIf Source = Picture1 Then
total = total + 260
ElseIf Source = Picture2 Then
total = total + 300
End If
Material de la Asignatura Programación 4to AI – Inst. San Rafael 7
Marisa E. Conde .
Especialista en Informática Educativa – UBA-

Text1.Text = total
End Sub

--------------------------------------------------------------------------------
11-COHETE

Private Sub Command1_Click()


Timer1.Enabled = True
End Sub

Private Sub Command2_Click()


End
End Sub
Private Sub Label1_Click()
Label1.Caption = Format("hh:mm:ss")
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single,


Y As Single) Colocar los siguientes controles
Timer1.Enabled = False 1 timer -2 command button
End Sub 1 label- 1 picture
Modificar: Timer:
Private Sub Timer1_Timer() Prod: enabled = False
Picture1.Move Picture1.Left, Picture1.Top - 100 Interval: 200
Label1.Caption = Format(Now, "hh:mm:ss") Modificar Picture
Propiedad DragMode=
End Sub
automatic
--------------------------------------------------------------------------------
12-CRUCIGRAMA

Private Sub Check1_Click() (programar c/u de los check)


If Text1.Text = "R" And Text2.Text = "E" And Text3.Text = "P" And Text4.Text = "T" And
Text5.Text = "I" And Text6.Text = "L"
Then
Label2.Caption = "Correcto"
Else
Label2.Caption = "InCorrecto"
End If
End Sub

Private Sub Command1_Click()


End
End Sub

Colocar los siguientes controles


Text (los necesarios) 3 checkbox
3 label 1 command button

----------------------------------------------------

13-Virus
Private Sub Command1_Click()
For A = 0 To 10
If A = 1 Then
MsgBox ("Se esta formateando el rígido")
ElseIf A = 2 Then
Material de la Asignatura Programación 4to AI – Inst. San Rafael 8
Marisa E. Conde .
Especialista en Informática Educativa – UBA-

MsgBox ("Se esta formateando el rigido")


ElseIf A = 3 Then
MsgBox ("Se esta formateando el rigido") Colocar los siguientes controles
ElseIf A = 4 Then 2 label 1 command button
MsgBox ("Se esta formateando el rigido")
ElseIf A = 5 Then
MsgBox ("Se esta formateando el rigido")
ElseIf A = 6 Then
MsgBox ("Se esta formateando el rigido")
ElseIf A = 7 Then
MsgBox ("Se esta formateando el rigido")
ElseIf A = 8 Then
MsgBox ("Se esta formateando el rigido")
ElseIf A = 9 Then
MsgBox ("A punto de estallar")
ElseIf A = 10 Then
MsgBox ("A punto de estallar")
ElseIf A = 11 Then
MsgBox ("A punto de estallar")
ElseIf A = 12 Then
MsgBox ("A punto de estallar")
ElseIf A = 33 Then
MsgBox ("A punto de estallar")
End If
Next A
lbl1.Visible = True
lbl1.Caption = "JA,JA.JA"
lbl1.BackColor = vbRed
Form1.BackColor = &H0&
End Sub
Private Sub Form_Load()
Form1.BorderStyle = 0
Randomize Timer
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) ' NO PERMITE


CERRAR LA BARRA DE TITULO HASTA QUE LLEGUE AL NUMERO DESEADO
Static contador As Integer
If UnloadMode = vbFormControlMenu Then
contador = contador + 1
If contador < 10 Then Beep: Cancel = True
End If
End Sub

También podría gustarte