Realizar un programa en gambas que perita sumar 2 números, mostrar los botones de control (resultado, borrar, salir).
n1
|
n2
|
S
|
5
|
6
|
11
|
10
|
9
|
19
|
Public sub button 1_click ( )
Textbox3.text= Val (textbox1.text)+ Val(textbox2.text)
End
Public sub button 2_click ( )
Textbox1.text= “ ”
Textbox1.Setfocus
End
Public sub button 3_click ( )
Quit
End
Ejercicio # 2
Generar un programa en gambas que me permita restar 2 valores .
n1
|
n2
|
R
|
5
|
2
|
3
|
10
|
5
|
5
|
Public sub button 1_click ( )
Textbox 3.text= Val (textbox1.text)- Val(textbox2.text)
End
Public sub button 2-click ( )
Textbox1.text= “ ”
Textbox2.Setfocus
End
Public sub button 3_click ( )
Quit
End
Ejercicio # 3
Generar un programa en gambas que me permita multiplicar 2 valores
n1
|
n1
|
M
|
2
|
2
|
4
|
3
|
3
|
9
|
Public sub button 1_click ( )
Textbox1.text= Val(textbox1.text)* Val(textbox2.text)
End
Public sub button 2_click ( )
Textbox1.text= “ ”
Textbox1.Setfocus
End
Public sub button 3_click ( )
Quit
End
Ejercicio # 4
Generar un programa en gambas que nos permita dividir 2 valores
n1
|
n2
|
D
|
10
|
2
|
5
|
30
|
5
|
6
|
Public sub button 1_click ( )
Textbox1.text=(textbox1.text)/ Val(textbox2.text)
End
Public sub button 2_click ( )
Textbox1.text= “ ”
Textbox1.Setfocus
End
Public sub button 3_click ( )
Quit
End
Ejercicio # 5
Realizar un programa en gambas que me permita ingresar por teclado el valor del producto, sacar el subtotal, el valor del IVA y el total al pagar .
P1
|
P2
|
St=p1+p2
|
I=st*0,12
|
T=st+i
|
T
|
10
|
20
|
St=10+20=30
|
I=30*0,12=3,6
|
T=30+3,6
|
33.6
|
Public sub button 1_click ( )
Textbox3.text=Val(textbox1.text)+ Val(textbox2.text)
Textbox4.text=Val(textbox3.text)* 0,12
Textbox5.text=Val(textbox3.text)+ Val(textbox4.text)
End
Public sub button 2_click ( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox5.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click ( )
Quit
End
Ejercicio #6
Realizar un programa que permita ingresar un valor determinado de metros , convertir a kilómetros a milímetros y centímetros
mt
|
Km=mt/1000
|
km
|
Mm=mt*1000
|
mm
|
Cm=mt*100
|
cm
|
3
|
Km=3/1000
|
0,003
|
Mm=3*1000
|
3000
|
Cm=3*100
|
300
|
Public sub button 1_click ( )
Textbox2.text=Val(textbox1.text)/ 1000
Textbox3.text=Val(textbox1.text)* 1000
Textbox4.text=Val(textbox1.text)* 100
End
Public sub button 2_click ( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click ( )
Quit
End
Ejercicio #7
Generar un programa que permita ingresar por teclado 2 valores calcular la suma, resta, multiplicación, división y finalmente mostrar los resultado por pantalla; elaborar diagrama, prueba, formulario y codificación
N1
|
N2
|
R=n1-n2
|
R
|
S=n1+n2
|
S
|
M=n1*n2
|
M
|
D=n1/n2
|
D
|
8
|
4
|
R=8-4
|
4
|
S=8+4
|
12
|
M=8*4
|
32
|
D=8/4
|
2
|
Public sub button 1_click ( )
Textbox3.text=Val(textbox1.text)- Val(textbox2.text)
Textbox4.text=Val(textbox1.text)+ Val(textbox2.text)
Textbox5.text=Val(textbox1.text)* Val(textbox2.text)
Textbox6.text=Val(textbox1.text)/ Val(textbob2.text)
End
Public sub button 2_click ( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox5.text= “ ”
Textbox6.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #8
Realizar o generar un programa que ingrese los valores active y pasivo y calcule el capital de la empresa.
1a
|
2p
|
1p
|
2p
|
Ta=1a+2a
|
Tp=1p+2p
|
C=ta-tp
|
8000
9000
|
7000
16000
|
450
4000
|
4000
4000
|
15000
25000
|
4450
14000
|
10550
11000
|
Public sub button 1_click( )
Textbox5.text=Val(textbox1.text)+ Val(textbox2.text)
Textbox6.text=Val(textbox3.text)+ Val(textbox4.text)
Textbox7.text=Val(textbox5.text)- Val(textbox6.text)
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox5.text= “ ”
Textbox6.text= “ ”
Textbox7.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
En
Ejercicio #9
Realizar una manifactura que permita calcular, subtotal, iva, total, valor en efectivo, cambio a recibir.
P1
|
P2
|
St=p1+p2
|
P=st*0,12
|
T=st+i
|
T
|
C
|
2
|
3
|
St=2+3=5
|
T=5*0,12=0,6
|
S=0,6+0,12
|
0,82
|
72
|
Public sub button 1_click( )
Textbox3.text=Val(textbox1.text)+ Val(textbox2.text)
Textbox4.text=Val(textbox3.text)* 0,12
Textbox5.text=Val(textbox3.text)+ Val(textbox4.text)
Textbox7.text=Val(textbox6.text)- Val(textbox5.text)
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox5.text= “ ”
Textbox6.text= “ ”
Textbox7.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #10
Generar un programa que calcule la raíz cubica de un valor y su potencial.
num
|
vp
|
Rc=3√num
|
rc
|
P=num^vp
|
p
|
8
|
2
|
Rc=3√8
|
2
|
P=81,2
|
64
|
Public sub button ¡_click( )
Textbox3.text=Val(textbox1.text)^ Val(textbox2.text)
End
Public sub button 2_click( )
Val(textbox1.text)
End
Public sub button 3_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox1.setfocus
End
Public sub button 4_click( )
Quit
End
Ejercicio #11
Calcular la superficie de un cuadrado y un circulo.
cu
|
ci
|
Sc=cu*cu
|
sc
|
Sci=(ci*ci)*3,1416
|
sci
|
4
|
5
|
4*4
|
16
|
(5*5)*3,1416
|
78,54
|
Public sub button 1_click( )
Textbox3.text=Val(textbox1.text)* Val(textbox1.text)
Textbox4.text=Val(textbox2.text)* Val(textbox2.text)
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #12
Calcular el área y el perímetro de un rectángulo.
b
|
h
|
A=b*h
|
a
|
P=2*(b+h)
|
p
|
5
|
3
|
A=5*3
|
15
|
P=2*(5+3)
|
16
|
Public sub button 1_click( )
Textbox3.text=Val(textbox1.text)* Val(textbox2.text)
Textbox4.text=2* Val(textbox1.text)+ Val(textbox2.text)
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #13
Generar una mini calculadora que permita sumar, restar, multiplicar , dividir , potencia y raíz cubica.
V1
|
V2
|
S=v1+v2
|
S
|
R=v1-v2
|
R
|
M=v1*v2
|
M
|
D=v1/v2
|
D
|
9
|
4
|
S=9+4
|
13
|
R=9-4
|
5
|
M=9*4
|
36
|
D=9/4
|
2,25
|
P=v1^v2
|
P
|
Rc=√v1√v2
|
Rc
| ||||||
P=9^4
|
81,16
|
Rc=√9√4
|
Rc=3 rc=2
|
Public sub button 1_click( )
Textbox3.text=Val(textbox1.text)+ Val(textbox2.text)
Textbox4.text=Val(textbox1.text)- Val(textbox2.text)
Textbox5.text=Val(textbox1.text)* Val(textbox2.text)
Textbox6.text=Val(textbox1.text)/ Val(textbox2.text)
Textbox7.text=Val(textbox1.text)^2 Val(textbox2.text)
Textbox8.text=Val(textbox1.text)sar Val(textbox2.text)
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox5.text= “ ”
Textbox6.text= “ ”
Textbox6.text= “ ”
Textbox7.text= “ ”
Textbox8.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #14
Realizar un programa en gambas que permita que calcula el área y el perímetro de un triángulo.
a
|
b
|
c
|
r
|
a+b+c
|
p
|
b*h/2
|
a
|
11
|
11
|
7.5
|
7
|
11+11+7.5
|
29.5
|
17*7/2
|
38.5
|
Public sub button 1_click( )
Textbox5.text=Val(textbox1.text)+ Val(textbox2.text)+ Val(textbox3.text)
Textbox6.text=Val(textbox2.text)*Val (textbox4.text)/ 2
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox5.text= “ ”
Textbox6.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #15
Realizar un programa que calcula el área de un cuadrado, triangulo y un rectángulo.
a
|
b
|
h
|
C=a*a
|
c
|
T=b*h/2
|
t
|
R=b*h
|
R
|
2
|
4
|
6
|
C=2*2
|
4
|
T=4*6/2
|
12
|
R=4*6
|
24
|
Public sub button 1_click( )
Textbox4.text=Val(textbox1.text)* Val(textbox1.text)
Textbox5.text=Val(textbox2.text)* Val(textbox3.text)/ 2
Textbox6.text=Val(textbox2.text)* Val(textbox3.text)
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox5.text= “ ”
Textbox6.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
quit
quit
End
Ejercicio #16
Realizar un programa que me permita ingresar por teclado 2 números determinar cuál de los número ingresado es el mayor .
pv
|
sv
|
Pv>=sv
|
R
|
Sv>pv
|
R
|
31
6
|
16
6
|
31>16
6>=6
|
Pv mayor
Los números son iguales
|
Public sub button 1_click( )
IF Val(textbox1.text)> Val(textbox2.text) THEN
Message(“el primer valor es mayor”)
Else
IF Val(textbox2.text)> Val(textbox1.text) THEN
Message(“el Segundo valor es mayor”)
Else
Message(“los números son iguales)
Endif
Endif
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #17
Realizar un programa en gambas que me permita determinar la edad en años de una persona, al mismo tiempo determinar si el resultado de la edad es mayor o menor de edad.
aa
|
an
|
Ed=aa-an
|
ed
|
Ed=>17
|
Respuesta
|
2014
|
1999
|
2014-1999
|
15
|
15>17
|
Usted es menor de edad
|
Public sub button 1_click( )
Textbox3.text=Val(textbox1.text)- Val(textbox2.text)
IF Val(textbox3.text)>17 THEN
Message(“usted es mayor de edad”)
Else
Message(“usted es menor de edad”)
Endif
End
Public sub button 2_click( )textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #18
Realizar un programa en gambas que me permita ingresar por teclado tres número determinado el mayor de ellos o si son iguales.
N1
|
N2
|
N3
|
N1>n2
|
R
|
N2>n1
|
R
|
N2>n1
|
R
|
5
|
10
|
5
|
5>10
|
N1 es mayor
|
10>5
|
N2mayor
|
5>5
|
Son iguales
|
Public sub button 1_click( )
IF Val(textbox1.text)> Val(textbox2.text) and Val(textbox2.text)> Val(textbox3.text) THEN
Label4.caption(“el segundo numero es mayor”)
Else
IF Val(texbox3.text)> Val(textbox1.text)and Val(textbox3.text)> Val(textbox2.text) THEN
Label4.caption(“el tercer numero es mayor”)
Else
Label4.caption(“todo los numero son iguales”)
Endif
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Message(“gracias y hasta pronto”)
Quit
End
Ejercicio #19
Realizar un programa que me permita ingresar un número determinado de tonelada, transformarlo a quintales, arrobas, kilos, libra y onzas.
t
|
Q=t*10
|
q
|
A=t*80
|
a
|
K=t*100
|
k
|
L=t**2000
|
L
|
O=t*64000
|
O
|
2
|
2*10
|
20
|
2*80
|
160
|
2*100
|
1818
|
2*2000
|
40000
|
2*64000
|
12800
|
Public sub button 1_click( )
Textbox2.text=Val(textbox1.text)* 10
Textbox3.text=Val(textbox1.text)* 80
Textbox4.text=Val(textbox1.text)* 100
Textbox5.text=Val(textbox1.text)* 2204
Textbox6.text=Val(textbox1.text)* 64000
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox5.text= “ ”
Textbox6.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
quit
quit
End
Ejercicio #21
Realizar un programa que calcula el área de un cuadrado, triangulo y un rectángulo.
a
|
b
|
h
|
C=a*a
|
c
|
T=b*h/2
|
t
|
R=b*h
|
R
|
2
|
4
|
6
|
C=2*2
|
4
|
T=4*6/2
|
12
|
R=4*6
|
24
|
Public sub button 1_click( )
Textbox4.text=Val(textbox1.text)* Val(textbox1.text)
Textbox5.text=Val(textbox2.text)* Val(textbox3.text)/ 2
Textbox6.text=Val(textbox2.text)* Val(textbox3.text)
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox5.text= “ ”
Textbox6.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
quit
quit
End
Ejercicio #22
Realizar un programa que me permita ingresar nombre y apellido por teclado tres empleado, ingresar el sueldo básico, numero de horas extras trabajadas por los empleados (5.70) el valor la hora extra el aporte a ices se da de 9.8 del sueldo básico, finalmente mostrar el total por cada empleado.
1empleado
|
2empleado
|
3empleado
|
sueldo
|
He
|
He
|
Pedro muñoz
|
Joel zambrano
|
Carlos burbano
|
360
|
7*5.70
39.9
|
3*5.70
17.1
|
He
|
Aporte
|
Aporte 1e
|
Aporte 2e
|
Aporte 3e
|
Total 1e
|
5*5.70
28.5
|
9.8
|
9.8/360
36.7
|
9.8/360
36.7
|
9.8/360
36.7
|
363.2
|
Total 2e
|
Total 3e
|
340.4
|
351.8
|
Public sub button 1_click( )
Textbox5.text=Val(textbox5.text)* 570
Textbox6.text=Val(textbox6.text)* 570
Textbox7.text=Val(textbox7.text)* 570
Textbox9.text=Val(textbox9.text)/ Val(textbox8.text)
Textbox10.text=Val(textbox10.text)/ Val(textbox8.text)- Val(textbox4.text)
Textbox13.text=Val(textbox4.text)+ Val(textbox6.text)
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox5.text= “ ”
Textbox6.text= “ ”
Textbox7.text= “ ”
Textbox8.text= “ ”
Textbox9.text= “ ”
Textbox10.text= “ ”
Textbox11.text= “ ”
Textbox12.text= “ ”
Textbox13.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #23
Realizar un programa que me permita ingresar por teclado un numero determinar si este número es positivo, negativo o neutro.
N1
|
If n1>0
|
If n1<0
|
If n1=0
| |||
7
-1
|
7>0
-1>0
|
Positivo
|
-1<0
|
Negativo
|
Public sub butto 1_click( )
IF Val(textbox1.text)> 0 THEN
Message(“el número es positive”)
Else
IF Val(textbox1.text)< 0 THEN
Message(“el numero es negativo”)
Else
IF Val(textbox1.text)= 0 THEN
Message(“el número es neutro)
Else
Message(“ingrese un numero”)
endif
endif
Endif
Endif
End
Public sub button 2_click( )
Textboa1.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #24
Realizar un programa en gambas que me permita ingresar por teclado un número determinado de meses transformarlo a década, lustro, siglos y milenios.
ms
|
D=ms/120
|
d
|
L=ms/60
|
L
|
S=ms/1200
|
s
|
Ml=ms/12000
|
Ml
|
60
|
60/120
|
0.5
|
60/60
|
1
|
60/1200
|
0.05
|
60/12000
|
0.005
|
Public sub button 1_click( )
Textbox2.text=Val(textbox1.text)/ 120
Textbox3.text=Val(textbox1.text)/ 60
Textbox4.text=Val(textbox1.text)/ 1200
Textbox5.text=Val(textbxo1.text)/ 12000
End
Public sub button 2_click( 9
Textbox1.text= “ ”
Textbox2.text= “ ”
Textbox3.text= “ ”
Textbox4.text= “ ”
Textbox5.text= “ ”
Textbox1.setfocus
Public sub butto 3_click( )
Quit
End
Ejercicio #25
Realizar un programa en gambas que me permita ingresar por teclado un numero si es impar o par.
V1
|
If v1 mod 2
| ||
6
7
|
If 6 mod 2
If 7 mod 2
|
El número es par
|
El número es impar
|
Public sub button 1_click( )
Dim v1 as integer
V1= textbox1.text
IF v1 mod 2 THEN
Message(“el número es impar”)
Else
Message(“el número es par”)
Endif
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #26
Realizar un programa que permita ingresar por teclado un número, determinar al mismo tiempo si es que el número ingresado es impar o par, positivo, negativo y neutro.
Public sub button 1_click( )
Dim n1 as integer
N1=textbox1.text
IF n1 mod 2 = 0 THEN
Message(“el numero es par”)
Else
Message (“el numero es impar”)
IF n1<0 mod 2=0 THEN
Message(“el numero es neutro”)
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #27
Realizar un programa que me permita determinar los rango de nuestro número ingresado si el número ingresar esta entre 1 y 30 muestre un mensaje dentro del rango si el numero pasa de 30 fuera de rango.
n
|
n>=1 and n<0
| ||
6
40
|
6>=1 and 6<=30
40>=1 and 6<=30
|
Dentro del rango
|
Fuera del rango
|
public sub button 1_click( )
dim a as integer
a= textbox1.text
IF a>=1 and a<=30
Message(“esta dentro del rango”)
Else
Message(“esta fuera de rango”)
Endif
End
Public sub button 2_click( )
Textbox1.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
Quit
End
Ejercicio #28
Realizar un programa que me permita por medio de su iniciales de su primer nombre y apellido que visualice nombre y apellido completes si ingreso otra letra diferente un mensaje que diga no hay texto con esa letra.
Public sub button 1_click( )
Select case textbox1.text
Case “j”,”J”
Message(“jair”)
Case “m”, “M”
Message(“mawyin”)
End select
End
Public sub button 2_click( )
textbox1.text= “ ”
textbox1.text= “ ”
Textbox1.setfocus
End
Public sub button 3_click( )
quit
quit
End
Ejerdicio # 29
Realizar un programa en gambas que me permita por medio de una clave de acceso ingresar a un formulario siempre y cuando la clave este correcta.
Public sub button 1_click( )
IF textbox1.text= “Jair” THEN
Message (“bienvenido al Sistema”)
Fmain.hide
Form1.show
Else
Message(“error en clave”)
Message(“intente otra vez”)
Textbox1.text= “ ”
Textbox1.setfocus
Endif
End
Public sub button 2_click( )
Dim rp as integer
Rp=message.question(“seguro que desea salir de la aplicacion”, “si”, “no”, “cancelar”)
IF rp=1 THEN
Me.close
Endif
End
Ejercicio #30
Realizar un programa que me permita por medio de una clave y usuario ingresar a un menú de operaciones básicas, en cada uno de la formularios deben haber 2 botones prediseñado con las codificaciones ya dispuesta.
Public sub button 1_click( )
Select case textbox1.text
Case”mawyin” , “MAWYIN”
Case else
Message(“nombre de usuario incorrecto”)
Message(“intente otra vez”)
End select
IF textbox2.text=(“JAIR”!) THEN
Message(“bienvenido a la aplicacion”)
Fmain.hide
Form1.show
Else
Message(“error al ingresar clave”)
message(“intente otra vez”)
message(“intente otra vez”)
Textbox2.text= “ ”
Textbox2.setfocus
Endif
End
Public sub button 2_click( )
Dim rp as integer
Rp=message.question(“seguro que desea salir de la aplicacion”, “si”, “no”, “cancelar”)
IF rp=1 THEN
Me.close
Endif
End
Public sub button 1_click ( )
Textbox3.text= Val (textbox1.text)+ Val(textbox2.text)
End
Public sub button 2_click ( )
Textbox1.text= “ ”
Textbox1.Setfocus
End
Public sub button 3_click ( )
Quit
End
Public sub button 1_click ( )
Textbox 3.text= Val (textbox1.text)- Val(textbox2.text)
End
Public sub button 2-click ( )
Textbox1.text= “ ”
Textbox2.Setfocus
End
Public sub button 3_click ( )
Quit
End
Public sub button 1_click ( )
Textbox1.text= Val(textbox1.text)* Val(textbox2.text)
End
Public sub button 2_click ( )
Textbox1.text= “ ”
Textbox1.Setfocus
End
Public sub button 3_click ( )
Quit
End
Public sub button 1_click ( )
Textbox1.text=(textbox1.text)/ Val(textbox2.text)
End
Public sub button 2_click ( )
Textbox1.text= “ ”
Textbox1.Setfocus
End
Public sub button 3_click ( )
Quit
End
Ejercicio #31
Generar un programa en gambas mediante ciclo for que me permita visualizar un número del 1 al 10
Public sub button 1_click( )
DIM A AS integer
DIM A AS integer
For A = 1 to 10
Listbox 1.add (A)
Next
End
Public sub button 2_click( )
Listbox1.clear
End
Public sub button 3_click( )DIM A AS integer
A=message.question(“ seguro que desea borrar los datos”, “SI” , “NO” , “CANCELAR”)
Quit
Endif
End
Ejercicio #32
Mediante la instrucción do wail generar un programa que me permita visualizar número del 50 al 80.
Public sub button 1_click( )
DIM A AS integer
A=so
Do while A<=80
Listbox1.add(A)
A=a+1
Loop
End
Public sub button 2_click( )
Listbox1.clear
End
Public sub button 3_click( )
DIM B AS integer
B=message.question(“seguro que desea salir” , “SI” , “NO”, “CANCELAR”)
Quit
End
Ejercicio #33
Realizar un programa en gambas mediante usuario y clave ( si el usuario y la clave por más de tres ocasiones la ubica incorrectamente salga de la aplicación) , en el formulario 1 generar números del 1 al 100 , en el formulario 2 numero del 100 al 1
Public Sub Button1_Click()
If TextBox1.text = "mawyin" And TextBox2.text = "jair" Then
Message(" BIENVENIDOS A LA APLICACION")
FMain.Hide
Form1.Show
Else
Message("USUARIO O CLAVE INCORRECTA")
Message("INTENTE OTRA VEZ")
TextBox1.Text = ""
TextBox2.text = ""
TextBox1.SetFocus
CONTADOR.text = Val(CONTADOR.text) + 1
Endif
If Val(CONTADOR.text) >= 4 Then
Me.Close(0)
Message(" LAMENTAMOS QUE NO PUEDAS INGRESAR")
Endif
End
Public Sub Button2_Click()
Dim A As Integer
A = Message.Question("¿ESTA SEGURO QUE QUIERE CERRAR ESTA
APLICACION?", "YES", "NO", "CANCELAR")
If A = 1 Then
Me.Close
Endif
End
Public sub button 1_click( )
DIM A AS integer
A= message.question(“esta seguro que desea salir” , “SI” , “NO” , “CANCELAR”)
If A = 1 then
Me.close
Endif
End
Public sub button 1_click( )
Listbox1.clear
End
Public sub button 2_click( )
DIM A AS integer
A= message.question(“seguro que desea salir” , “SI” , “NO” , “CANCELAR”)
Quit
End
Public sub button 3_click( )
DIM B AS integer
For B = 1 to 100
Listbox1.ADD (B)
Next
End
Public sub button 4_click( )
Form2.hide
Form1.show
End
Public sub button 1_click( )
Listbox1.clear
End
Public sub button 2_click( )
DIM A AS integer
A= message.question(“seguro que desea salir” , “SI” , “NO” , “CANCELAR”)
Quit
End
Public sub button 3_click( )
DIM B AS integer
For B = 100 to 1 step -1
Listbox1.ADD (B)
Next
End
Public sub button 4_click( )
Form3.hide
Form1.show
End
Ejercicio #35
Realizar un programa en gambas que me permita ingresar por teclado los datos de un cliente ( nombre, apellido, dirección y teléfono). Ingresar el valor de tres articulo calcular el total de los tres articulo , si el total obtenido es menor a 200 obtener el 10% de descuento, si el total obtenido es menor a 400 sacar 16% y si el total obtenido mayor a 400 sacar el 25%.
Public Sub Button1_Click()
TextBox8.Text = (TextBox5.Text) + (TextBox6.Text) + (TextBox7.Text)
If Val(TextBox8.Text) < 200 Then
Message(" 10% DE DESCUENTO")
TextBox8.Text = (TextBox8.Text) * 0.1
Else
If Val(TextBox8.Text) < 400 Then
Message(" 16% DE DESCUENTO")
TextBox8.Text = (TextBox8.Text) * 0.16
Else
If Val(TextBox8.Text) > 400 Then
Message(" 25% DE DESCUENTO")
TextBox8.Text = (TextBox8.Text) * 0.25
Endif
Endif
Endif
End
Public Sub Button2_Click()
Dim C As Integer
C = Message.Question("¿ESTA SEGURO QUE DESEA BORRAR ESTOS
DATOS? ", "YES", "NO", "CANCELAR")
If C = 1 Then
TextBox1.text = ""
TextBox2.text = ""
TextBox3.text = ""
TextBox4.text = ""
TextBox5.text = ""
TextBox6.text = ""
TextBox7.text = ""
TextBox8.Text = ""
TextBox1.setfocus
Endif
End
Public Sub Button3_Click()
Dim C As Integer
C = Message.Question("¿ESTA SEGURO QUE QUIERE CERRAR ESTA APLICACION?", "YES ", " NO ", " CANCELAR ")
If C = 1 Then
Quit
Endif
End
Ejercicio #35
Realizer un programa en gambas que me permita hacer una calculadora con la operaciones básicas.
Public ban As Integer
Public aux1 As Float
Public Log As Float
Public Sqr As Integer
Public Cbr As Integer
Public Sub _new()
End
Public Sub Form_Open()
End
Public Sub Button1_Click()
TextBox1.Text = TextBox1.Text & "1"
End
Public Sub Button2_Click()
TextBox1.Text = TextBox1.Text & "2"
End
Public Sub Button3_Click()
TextBox1.Text = TextBox1.Text & "3"
End
Public Sub Button4_Click()
TextBox1.Text = TextBox1.Text & "4"
End
Public Sub Button7_Click()
TextBox1.Text = TextBox1.Text & "5"
End
Public Sub Button5_Click()
TextBox1.Text = TextBox1.Text & "6"
End
Public Sub Button8_Click()
TextBox1.Text = TextBox1.Text & "7"
End
Public Sub Button6_Click()
TextBox1.Text = TextBox1.Text & "8"
End
Public Sub Button9_Click()
TextBox1.Text = TextBox1.Text & "9"
End
Public Sub Button10_Click()
TextBox1.Text = TextBox1.Text & "0"
End
Public Sub Button11_Click()
TextBox1.Text = TextBox1.Text & "."
End
Public Sub Button12_Click()
If ban = 1 Then
TextBox1.TEXT = aux1 + (TextBox1.Text)
Endif
If ban = 2 Then
TextBox1.TEXT = aux1 - (TextBox1.Text)
Endif
If ban = 3 Then
TextBox1.TEXT = aux1 * (TextBox1.Text)
Endif
If ban = 4 Then
TextBox1.TEXT = aux1 / (TextBox1.Text)
Endif
End
Public Sub Button15_Click()
ban = 1
If TextBox1.text <> 0 Then
aux1 = (TextBox1.text)
Else
aux1 = 0
Endif
TextBox1.Clear
End
Public Sub Button16_Click()
ban = 2
If TextBox1.text <> 0 Then
aux1 = (TextBox1.text)
Else
aux1 = 0
Endif
TextBox1.clear
End
Public Sub Button17_Click()
ban = 3
If TextBox1.text <> 0 Then
aux1 = (TextBox1.text)
Else
aux1 = 0
Endif
TextBox1.clear
End
Public Sub Button18_Click()
ban = 4
If TextBox1.text <> 0 Then
aux1 = (TextBox1.text)
Else
aux1 = 0
Endif
TextBox1.clear
End
Ejercicio #36
Realizar un programa en gambas que me permita por medio de un click en tres botones ingresado , ubicar en cada botón color amarillo, azul y rojo y con el mismo click ubicar el fondo del formulario de color verde.
Public Sub Label1_MouseDown()
Button1.Background = (&HFF0000)
Button2.Background = (&HFF0000FF)
Button3.Background = (&HFFFF00)
FMain.Background = (&H00FFF00)
End
Public Sub Button4_Click()
Dim M As Integer
M = Message.Question("¿ESTA SEGURO QUE QUIERE CERRAR ESTA APLICACIÓN?", "YES ", " NO ", " CANCELAR ")
If M = 1 Then
Me.Close
Endif
End
Ejercicio # 37
Realizar un programa que me permita simular por medio de un click los botones la cara de gruñon.
Public Sub Label1_MouseDown()
Button11.Background = (&HFFFF3EFF)
Button12.Background = (&HFFFF3EFF)
Button16.Background = (&HFFFF3EFF)
Button17.Background = (&HFFFF3EFF)
Button20.Background = (&HFFFF3EFF)
Button21.Background = (&HFFFF3EFF)
Button23.Background = (&HFFFF3EFF)
Button25.Background = (&HFFFF3EFF)
Button26.Background = (&HFFFF3EFF)
Button32.Background = (&HFFFF3EFF)
Button41.Background = (&HFFFF3EFF)
Button57.Background = (&HFFFF3EFF)
Button63.Background = (&HFFFF3EFF)
Button68.Background = (&HFFFF3EFF)
Button72.Background = (&HFFFF3EFF)
Button78.Background = (&HFFFF3EFF)
Button79.Background = (&HFFFF3EFF)
Button80.Background = (&HFFFF3EFF)
Button91.Background = (&HFFFF9F3E)
Button92.Background = (&HFFFF9F3E)
Button94.Background = (&HFFFF9F3E)
Button96.Background = (&HFFFF9F3E)
Button98.Background = (&HFFFF9F3E)
Button97.Background = (&HFFFF9F3E)
Button102.Background = (&HFFFF9F3E)
Button103.Background = (&HFFFF9F3E)
Button104.Background = (&HFFFF9F3E)
Button107.Background = (&HFFFF9F3E)
Button106.Background = (&HFFFF9F3E)
Button110.Background = (&HFFFF9F3E)
Button114.Background = (&HFFFF9F3E)
Button117.Background = (&HFFFF9F3E)
Button121.Background = (&HFFFF9F3E)
Button126.Background = (&HFFFF9F3E)
Button129.Background = (&HFFFF9F3E)
Button131.Background = (&HFFFF9F3E)
Button133.Background = (&HFFFF9F3E)
Button134.Background = (&HFFFF9F3E)
Button135.Background = (&HFFFF9F3E)
Button136.Background = (&HFFFF9F3E)
Button140.Background = (&HFFFF9F3E)
Button144.Background = (&HFFFF9F3E)
Button151.Background = (&HFFFF9F3E)
Button154.Background = (&HFFFF9F3E)
Button158.Background = (&HFFFF9F3E)
Button161.Background = (&HFFFF9F3E)
Button167.Background = (&HFFFF9F3E)
Button168.Background = (&HFFFF9F3E)
Button169.Background = (&HFFFF9F3E)
Button170.Background = (&HFFFF9F3E)
Button171.Background = (&HFFFF9F3E)
Button173.Background = (&HFFFF9F3E)
Button174.Background = (&HFFFF9F3E)
Button175.Background = (&HFFFF9F3E)
Button178.Background = (&HFFFF9F3E)
Button187.Background = (&HFFFF9F3E)
Button192.Background = (&HFFFF9F3E)
Button193.Background = (&HFFFF9F3E)
Button194.Background = (&HFFFF9F3E)
Button195.Background = (&HFFFF9F3E)
Button196.Background = (&HFFFF9F3E)
Button197.Background = (&HFFFF9F3E)
FMain.Background = (&HFF000000)
End
Public Sub Button91_Click()
Dim N As Integer
N = Message.Question("¿ESTA SEGURO QUE QUIERE CERRAR ESTA APLICACION?", "YES ", " NO ", " CANCELAR ")
If N = 1 Then
Quit
Endif
End
Ejercicio #38
Realizar un programa en gambas que me permita mediante clave y usuario crear tres. Formulario 1 generar numero del 1 al 100 (1 al 50 en 2 en 2 ) y del 51 al 100 de 3 en 3. Formulario 2 por medio de tres asignatura ingresada que el usuario le muestre la especialidad a elegir. Formulario 3 mediante el do waile generar numero del 100 al 0 de forma descendente.
Public Sub Button1_Click()
If TextBox1.text = ("jair") Then
Message("CLAVE CORRECTA")
Else
Message.Error("CLAVE ERRONEA")
Message("INTENTE OTRA VEZ")
TextBox1.Text = ""
TextBox1.SetFocus
Endif
If TextBox2.text = ("mawyin") Then
Message("NOMBRE DEL USUARIO CORRECTO")
Else
Message.Error("NOMBRE DEL USUARIO ERRONEO")
Message("INTENTE OTRA VEZ")
TextBox2.Text = ""
TextBox2.SetFocus
Endif
If TextBox1.text = ("jair") And TextBox2.text = ("mawyin") Then
Message("BIENVENIDOS AL SISTEMA")
FMain.Hide
Form1.Show
Endif
End
Public Sub Button2_Click()
Dim A As Integer
A = Message.Question("¿ESTA SEGURO QUE QUIERE CERRAR ESTA
APLICACION?", "YES", "NO", "CANCELAR")
If A = 1 Then
Me.Close
Endif
End
Public Sub Button1_Click()
Dim A As Integer
For A = 1 To 50 Step +2
ListBox1.Add(A)
Next
For A = 50 To 100 Step +3
ListBox1.Add(A)
Next
End
Public Sub Button2_Click()
Dim A As Integer
A = Message.Question("¿ ESTA SEGURO QUE DESEA BORRAR ESTOS
DATOS? ", "YES", "NO", "CANCELAR")
If A = 1 Then
ListBox1.Clear
Endif
End
Public Sub Button3_Click()
Dim A As Integer
A = Message.Question("¿ESTA SEGURO QUE QUIERE CERRAR ESTA
APLICACION?", "YES", "NO", "CANCELAR")
If A = 1 Then
Me.Close
Endif
End
Public Sub ToggleButton1_Click()
Form1.Hide
Form2.Show
End
Public Sub ToggleButton2_Click()
Form1.Hide
FMain.Hide
End
Public Sub Button1_Click()
Dim A As Integer
A = 1000
Do While A >= 0
ListBox1.Add(A)
A = A - 1
Loop
End
Public Sub Button2_Click()
Dim A As Integer
A = Message.Question("¿ ESTA SEGURO QUE DESEA BORRAR ESTOS
DATOS? ", "YES", "NO", "CANCELAR")
If A = 1 Then
ListBox1.Clear
Endif
End
Public Sub Button3_Click()
Dim A As Integer
A = Message.Question("¿ESTA SEGURO QUE QUIERE CERRAR ESTA
APLICACION?", "YES", "NO", "CANCELAR")
If A = 1 Then
Me.Close
Endif
End
Public Sub ToggleButton1_Click()
Form3.Hide
Form2.Show
End
Public Sub Button1_Click()
TextBox4.Text = (TextBox1.Text) + (TextBox2.Text) + (TextBox3.Text)
If Val(TextBox4.Text) < 600 Then
Message("DERECHOS")
TextBox4.Text = (TextBox4.Text) / 3
Else
If Val(TextBox4.Text) < 700 Then
Message("GINECOLOGIA")
TextBox4.Text = (TextBox4.Text) / 3
Else
If Val(TextBox4.Text) > 800 Then
Message("DOCENTE")
TextBox4.Text = (TextBox4.Text) / 3
Endif
Endif
Endif
End
Public Sub Button2_Click()
Dim A As Integer
A = Message.Question("¿ ESTA SEGURO QUE DESEA BORRAR ESTOS
DATOS? ", "YES", "NO", "CANCELAR")
If A = 1 Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox1.SetFocus
Endif
End
Public Sub Button3_Click()
Dim A As Integer
A = Message.Question("¿ESTA SEGURO QUE QUIERE CERRAR ESTA
APLICACION?", "YES", "NO", "CANCELAR")
If A = 1 Then
Me.Close
Endif
End
Public Sub ToggleButton1_Click()
Form2.Hide
Form3.Show
End
Public Sub ToggleButton2_Click()
Form2.Hide
Form1.Show
End
Ejercicio # 39
Realizer un programa mediante comboxbox y radio button que permita las 4 operaciones básicas.
Public Sub ComboBox1_Click()
If ComboBox1.Text = "SUMA" Then
TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
Else
If ComboBox1.Text = "RESTA" Then
TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
Else
If ComboBox1.Text = "MULTIPLICACION" Then
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
Else
If ComboBox1.Text = "DIVISION" Then
TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
Endif
Endif
Endif
Endif
End
Public Sub RadioButton1_Click()
TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
End
Public Sub RadioButton3_Click()
TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
End
Public Sub RadioButton2_Click()
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
End
Public Sub RadioButton4_Click()
TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
End
Public Sub Button1_Click()
Dim A As Integer
A = Message.Question("¿SEGURO QUE DESEA BORRAR ESTOS DATOS?", "YES", "NO", "CANCELAR")
If A = 1 Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox1.SetFocus
Endif
End
Public Sub Button2_Click()
Dim A As Integer
A = Message.Question("¿SEGURO QUE DESEA SALIR DE LA
APLICACION?", "YES", "NO", "CANCELAR")
If A = 1 Then
Me.Close
Endif
End
Ejercicio #40
Realizar un programa en gambas que me permita realizar un semáforo.
Public Sub Timer1_Timer()
C.TEXT = C.TEXT + 1
If C.TEXT = 1 Then
Button1.Visible = False
Button2.Visible = False
Button3.Visible = True
Else If C.TEXT = 22 Then
Button1.Visible = False
Button2.Visible = True
Button3.Visible = True
Else If C.TEXT = 23 Then
Button1.Visible = False
Button2.Visible = False
Button3.Visible = True
Else If C.TEXT = 24 Then
Button1.Visible = False
Button2.Visible = True
Button3.Visible = True
Else If C.TEXT = 25 Then
Button1.Visible = False
Button2.Visible = False
Button3.Visible = True
Else If C.TEXT = 26 Then
Button1.Visible = False
Button2.Visible = True
Button3.Visible = True
Else If C.TEXT = 27 Then
Button1.Visible = False
Button2.Visible = False
Button3.Visible = True
Else If C.TEXT = 28 Then
Button1.Visible = False
Button2.Visible = True
Button3.Visible = True
Else If C.TEXT = 29 Then
Button1.Visible = True
Button2.Visible = False
Button3.Visible = False
Else If C.TEXT = 50 Then
Button1.Visible = True
Button2.Visible = False
Else If C.TEXT = 51 Then
Button1.Visible = True
Button2.Visible = False
Else If C.TEXT = 52 Then
Button1.Visible = True
Button3.Visible = False
Else If C.TEXT = 53 Then
Button1.Visible = True
Button3.Visible = False
Else If C.TEXT = 54 Then
Button1.Visible = True
Button3.Visible = False
Else If C.TEXT = 55 Then
Button1.Visible = True
Button3.Visible = False
Else If C.TEXT = 56 Then
Button1.Visible = True
Button3.Visible = False
Else If C.TEXT = 57 Then
Button1.Visible = True
Button3.Visible = False
Else If C.TEXT = 58 Then
Button1.Visible = True
Button3.Visible = False
Else If C.TEXT = 59 Then
C.TEXT = 0
Endif
End
Public Sub Button4_Click()
Dim A As Integer
A = Message.Question("¿SEGURO QUE DESEA SALIR ?", "YES", "NO",
"CANCELAR")
If A = 1 Then
Me.Close
Endif
End
Ejercicio # 41
REALIZAR UN PROGRAMA QUE ME PERMITA POR MEDIO DE LA FECHA DE NACIMIENTO DETERMINAR EL SIGNO ZODIACAL Y QUE PRESENTE SU SIGNO.
Public Sub Button1_Click()
Dim dia As Integer
dia = ComboBox1.Text
Select Case ComboBox2.Text
Case "enero", "ENERO", "Enero"
If dia < 21 Then
PictureBox1.Picture = Picture["capricornio.jpg"]
Message.Info("USTED ES DE SIGNO CAPRICORNIO ")
Else
If dia > 31 Then
Message.Info("ESTA DIA NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["acuario.jpg"]
Message.Info("USTED ES DE SIGNO ACUARIO")
Endif
Endif
Case "febrero", "FEBRERO", "Febrero"
If dia < 20 Then
PictureBox1.Picture = Picture["acuario.jpg"]
Message.Info("USTED ES DE SIGNO ACUARIO")
Else
If dia > 28 Then
Message.Info("ESTE DIA NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["piscis.jpg"]
Message.Info("USTED ES DE SIGNO PICIS")
Endif
Endif
Case "marzo", "MARZO", "Marzo"
If dia < 21 Then
PictureBox1.Picture = Picture["picis.jpg"]
Message.Info("USTED ES DE SIGNO PICIS")
Else
If dia > 29 Then
Message.Info("ESTE DIA NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["aries.jpg"]
Message.Info("USTED ES DE SIGNO ARIES")
Endif
Endif
Case "abril", "ABRIL", "Abril"
If dia < 19 Then
PictureBox1.Picture = Picture["aries.jpg"]
Message.Info("USTED ES DE SIGNO ARIES")
Else
If dia > 30 Then
Message.Info("ESTE DIA NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["tauro.jpg"]
Message.Info("USTED ES DE SIGNO TAURO")
Endif
Endif
Case "mayo", "MAYO", "Mayo"
If dia < 20 Then
PictureBox1.Picture = Picture["tauro.jpg"]
Message.Info("USTED ES DE SIGNO TAURO")
Else
If dia > 31 Then
Message.Info("ESTE DIA NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["geminis.jpg"]
Message.Info("USTED ES DE SIGNO GEMENIS")
Endif
Endif
Case "junio", "JUNIO", "Junio"
If dia < 20 Then
PictureBox1.Picture = Picture["geminis.jpg"]
Message.Info("USTED ES DE SIGNO GEMENIS")
Else
If dia > 30 Then
Message.Info("ESTE DI NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["cancer.jpg"]
Message.Info("USTED ES DE SIGNO CANCER")
Endif
Endif
Case "julio", "JULIO", "Julio"
If dia < 23 Then
PictureBox1.Picture = Picture["cancer.jpg"]
Message.Info("USTED ES DE SIGNO CANCER")
Else
If dia > 31 Then
Message.Info("ESTE DIA NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["leo.jpg"]
Message.Info("USTED ES DE SIGNO LEO")
Endif
Endif
Case "agosto", "AGOSTO", "Agosto"
If dia < 23 Then
PictureBox1.Picture = Picture["leo.jpg"]
Message.Info("USTED ES DE SIGNO LEO")
Else
If dia > 30 Then
Message.Info("ESTE DIA NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["virgo.jpg"]
Message.Info("USTED ES DE SIGNO VIRGO")
Endif
Endif
Case "septiembre", "SEPTIEMBRE", "Septiembre"
If dia < 23 Then
PictureBox1.Picture = Picture["virgo.jpg"]
Message.Info("USTED ES DE SIGNO VIRGO ")
Else
If dia > 30 Then
Message.Info("ESTE DIA NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["libra.jpg"]
Message.Info("USTED ES DE SIGNO LIBRA")
Endif
Endif
Case "octubre", "OCTUBRE", "Octubre"
If dia < 23 Then
PictureBox1.Picture = Picture["libra.jpg"]
Message.Info("USTED ES DE SIGNO LIBRA")
Else
If dia > 31 Then
Message.Info("ESTE DIA NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["escorpio.jpg"]
Message.Info("USTED ES DE SIGNO ESCORPIO")
Endif
Endif
Case "noviembre", "NOVIEMBRE", "Noviembre"
If dia < 22 Then
PictureBox1.Picture = Picture["escorpio.jpg"]
Message.Info("USTED ES DE SIGNO ESCORPIO")
Else
If dia > 29 Then
Message.Info("ESTE DIA NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["sagitario.jpg"]
Message.Info("USTED ES DE SIGNO SAGITARIO")
Endif
Endif
Case "diciembre", "DICIEMBRE", "Diciembre"
If dia < 22 Then
PictureBox1.Picture = Picture["sagitario.jpg"]
Message.Info("USTED ES DE SIGNO SAGITARIO")
Else
If dia > 31 Then
Message.Info("ESTE DIA NO EXISTE EN ESTE MES")
Else
PictureBox1.Picture = Picture["capricornio.jpg"]
Message.Info("USTED ES DE SIGNO CAPRICORNIO")
Endif
Endif
End Select
End
Public Sub Button2_Click()
Dim A As Integer
A = Message.Question("¿ESTAS SEGURO QUE DESEAS SALIR DE LA
APLICACION?", "YES", "NO", " CANCELAR ")
If A = 1 Then
Message("GRACIA POR PREFERIRINOS")
Quit
Endif
End
Ejercicio #42
Realizar un programa en gambas que mediante una tabletviuw genere tres campos y lo valla agregando, mediante opción de menú ejecutar el botón salir.
Public Sub Form_Open()
TableView1.Columns.Count = 3
TableView1.Columns[0].text = "NOMBRES"
TableView1.Columns[0].WIDTH = 200
TableView1.Columns[1].text = "OCUPACION"
TableView1.Columns[1].WIDTH = 200
TableView1.Columns[2].text = "DIRECCION"
TableView1.Columns[2].WIDTH = 250
End
Public Sub Button1_Click()
Dim ROW As Integer = TableView1.Rows.Count
If txt_nombre.Text <> "" And txt_ocupacion.Text <> "" And txt_direccion.Text <> "" Then
TableView1.Rows.Count += 1
TableView1[ROW, 0].Text = txt_nombre.Text
TableView1[ROW, 1].Text = txt_ocupacion.Text
TableView1[ROW, 2].Text = txt_direccion.Text
Else
Message.Info("NO DEJAR ESPACIOS EN BLANCO")
Endif
End
Public Sub Menu2_Click()
Dim F As Integer
F = Message.Question("¿SEGURO QUE DESEA SALIR DE LA
APLICACION?", "YES", "NO", "CANCELAR")
If F = 1 Then
Me.Close
Endif
End
Public Sub Button2_Click()
Dim A As Integer
A = Message.Question("¿SEGURO QUE DESEA BORRAR ESTOS DATOS?",
"YES", "NO", "CANCELAR")
If A = 1 Then
txt_nombre.Clear
txt_ocupacion.Clear
txt_direccion.Clear
txt_nombre.SetFocus
Endif
End
Ejercicio #43
Mediante una tabletviuw ingrese 6 columnas ( numero de matricula, nombre, apellido, fecha de nacimiento, edad, dirección) ubicar botones, guardar, agregar, limpiar, abrir e imprimir.
Public Controlador As Boolean
Public lineas As String
Public destino As String
Public Sub _new()
End
Public Sub Form_Open()
TableView1.Columns.Count = 6
TableView1.Columns[0].text = "NUMERO DE MATRICULA"
TableView1.Columns[0].WIDTH = 250
TableView1.Columns[1].text = "NOMBRES"
TableView1.Columns[1].WIDTH = 250
TableView1.Columns[2].text = "APELLIDOS"
TableView1.Columns[2].WIDTH = 250
TableView1.Columns[3].text = "FECHA NACIMIENTO"
TableView1.Columns[3].WIDTH = 250
TableView1.Columns[4].text = "EDAD"
TableView1.Columns[4].WIDTH = 250
TableView1.Columns[5].text = "DIRECCION"
TableView1.Columns[5].WIDTH = 250
End
Public Sub Button1_Click()
Dim ROW As Integer = TableView1.Rows.Count
If txt_numeromatricula.Text <> "" And txt_nombres.Text <> "" And
txt_apellidos.Text <> "" And txt_fecnacimiento.Text <> " " And txt_edad.Text
<> "" And txt_direction.Text <> "" Then
TableView1.Rows.Count += 1
TableView1[ROW, 0].Text = txt_Numeromatricula.Text
TableView1[ROW, 1].Text = txt_nombres.Text
TableView1[ROW, 2].Text = txt_apellidos.Text
TableView1[ROW, 3].Text = txt_fecnacimiento.Text
TableView1[ROW, 4].Text = txt_edad.Text
TableView1[ROW, 5].Text = txt_direction.Text
Else
Message.Info("NO DEJAR ESPACIOS EN BLANCO")
Endif
End
Public Sub Button2_Click()
Dim A As Integer
A = Message.Question("¿SEGURO QUE DESEA BORRAR ESTOS DATOS?",
"YES", "NO", "CANCELAR")
If A = 1 Then
txt_numeromatricula.Clear
txt_nombres.Clear
txt_apellidos.Clear
txt_fecnacimiento.Clear
txt_edad.Clear
txt_direction.Clear
txt_numeromatricula.SetFocus
Endif
End
Public Sub bntGuardar_Click()
lineas = TableView1.Row
Dialog.Title = "Seleccione un Archivo"
Dialog.filter = ["Datos de Agenda(*.docx] ", "Todos los ficheros(*.*)"]
If Not Dialog.SaveFile() Then
If Right$(Dialog.Path, 5) <> ".docx" Then
destino = Dialog.Path & ".docx"
Else
destino = Dialog.Path
End If
File.Save(destino, lineas)
End If
End
Public Sub Menu2_Click()
Dim V As Integer
V = Message.Question("¿SEGURO QUE DESEA SALIR DE LA
APLICACION?", "YES", "NO", "CANCELAR")
If V = 1 Then
Me.Close
Endif
End
Public Sub Button4_Click()
Dim C As String
Dim arr_cadenas As String[]
Dialog.title = "seleccione un archivo"
Dialog.filter = ["datos de agenda(*.data)", "todoslos ficheros(*.*)"]
If Not Dialog.OpenFile() Then
arr_cadenas = Split(File.Load(Dialog.Path), "\n")
TableView1.Clear()
For Each C In arr_cadenas
TableView1.add(c)
Next
Endif
End
Public Sub Printer1_Draw()
End
Public Sub Menu4_Click()
Me.Enabled = False
Inc
Application.Busy
Printer1.Print
Dec Application.Busy
Me.Enabled = True
End
Public Sub TableView1_Click()
If TableView1.Index > 0 Then
Message.Info(TableView1.Current.data)
Endif
End.
tendrán algún código en gambas que permita conectarme a otro pc con linux de forma remota
ResponderEliminar