viernes, 25 de septiembre de 2009

UNIDAD I

Convertir texto a binario


Convertir grados


Private Sub Command1_Click()
cent = (9 / 5) * (Text1)
po = cent + 32
Label3 = po
Text1 = ""
Text1.SetFocus
End Sub

Private Sub Command2_Click()
End
End Sub

Agrega a Lista


Private Sub botón_Click()

Text1.SetFocus

List1.AddItem (Text1)

Text1 = ""

End Sub

Timer


Private Sub Timer1_Timer()
Label2 = Time
End Sub

jueves, 24 de septiembre de 2009

Ascendente y Descendente



Dim arreglo(99) As Integer
Dim I As Integer
Private Sub Command1_Click()
For I = 0 To 99
arreglo(I) = CInt(Rnd(100) * 100)
List1.AddItem arreglo(I)
Next I
End Sub
Private Sub Command2_Click()
List1.Clear
For I = 0 To 99 Step 1
List1.AddItem arreglo(99 - I)
Next I
End Sub
Private Sub Command3_Click()
List1.Clear
For I = 0 To 99
List1.AddItem arreglo(I)
Next I
End Sub



DÍA_Mes_Año...Progresivamente

Private Sub HScroll1_Change()

Label1.Caption = HScroll1

End Sub
Private Sub HScroll2_Change()

Label2.Caption = HScroll2

End Sub
Private Sub HScroll3_Change()

Label3.Caption = HScroll3

End Sub

Desplega Datos


Private Sub Command1_Click()
Text1.SetFocus
Combo1.AddItem (Text1)
Text1 = ""
End Sub

Días vividos


Private Sub Calendar1_Click()
Text2.Text = Calendar1
Text3 = Str(CDate(Label1) - CDate(Text2))
End Sub
Private Sub Command1_Click()
Dim item As String
item = UCase(Text1) + Space(5) + Label1 + Space(5) + Str(Calendar1) + Space(5) + Text3
List1.AddItem item
Text1 = ""
Text2 = ""
Text3 = ""
End Sub
Private Sub Form_Load()
Label1.Caption = Date
End Sub

Día/Mes/Año


Private Sub Calendar1_Click()
MsgBox Calendar1
End Sub

Arreglo & Promedio


Dim arreglo(9) As Integer
Dim i As Integer
Dim promedio As Single
Private Sub Command1_Click()
i = 0
promedio = 0
Text1 = ""
Text2 = ""
Text3 = ""
End Sub
Private Sub Command2_Click()
End
End Sub

Escriba un Número Entero


Private Sub Command1_Click()
Dim a As Integer
a = InputBox("escriba un numero entero", 0)
End Sub

Datos abstractos

Private Sub Command1_Click()
MsgBox ("Tipos de datos abstractos")
End Sub



Convertir Minúsculas a Mayúsculas


Private Sub Command1_Click()
UCase (Text1)
Text2 = UCase(Text1)
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Text1.SetFocus
Text1 = ""
Text2 = ""
End Sub

Calculadora


Dim bsuma, bresta, bmulti, bdivicion As Boolean
Dim divicion As Single
Dim suma, resta, multi, resultado As Integer
Private Sub command1_click()
Text1 = Text1 + Str(1)
End Sub
Private Sub Command10_Click()
Text1 = Text1 + Str(0)
End Sub
Private Sub Command11_Click()
suma = Val(Text1)Text1 = ""
bsuma = True
End Sub

Private Sub Command12_Click()
resta = Val(Text1)Text1 = ""
bresta = True
End Sub

Private Sub Command13_Click()
multi = Val(Text1)Text1 = ""
bmulti = True
End Sub

Private Sub command15_click()
If bsuma = True Then
resultado = resultado + Val(Text1)
suma = suma + Val(Text1)
Text1 = Str(suma)
bsuma = False
End If
If bresta = True Then
resultado = resultado + Val(Text1)
resta = resta - Val(Text1)
Text1 = Str(resta)
bresta = False
End If
If bmulti = True Then
resultado = resultado + Val(Text1)
multi = multi * Val(Text1)
Text1 = Str(multi)
bmulti = False
End If
If bdivicion = True Then
resultado = resultado + Val(Text1)
divicion = divicion / Val(Text1)
Text1 = Str(divicion)
bdivicion = False
End If
End Sub

Private Sub Command16_Click()
Text1 = 0
suma = 0
resta = 0
multi = 0
divicion = 0
End Sub



Private Sub Command2_Click()
Text1 = Text1 + Str(2)
End Sub
Private Sub Command3_Click()
Text1 = Text1 + Str(3)
End Sub
Private Sub Command4_Click()
Text1 = Text1 + Str(4)
End Sub
Private Sub Command5_Click()
Text1 = Text1 + Str(5)End Sub
Private Sub Command6_Click()
Text1 = Text1 + Str(6)
End Sub
Private Sub Command7_Click()
Text1 = Text1 + Str(7)
End Sub
Private Sub Command8_Click()
Text1 = Text1 + Str(8)
End Sub
Private Sub Command9_Click()
Text1 = Text1 + Str(9)
End Sub
Private Sub command14_click()
divicion = Val(Text1)
Text1 = ""
bdivicion = True
End Sub

¡¡¡Bienvenido a Visual Basic!!!


Private Sub Command1_Click()
MsgBox ("¡¡¡ Bienvenido a Visual Basic !!!")
End Sub

Suma


Private Sub Command1_Click()
Dim a, b As Integera
a= InputBox("escriba el valor de a:", 0)
b = InputBox("escriba el valor de b:", 0)
MsgBox (a + b)
End Sub