SlideShare a Scribd company logo
1 of 16
Gambas
Es un lenguaje de programacion libre derivado de Basic.Se
distribuye con licencia GNU GPL. Cabe destacar que presenta
ciertas similitudes con javas ya que en la ejecución de cualquier
aplicación, se requiere un conjunto de librerías interprete
previamente instaladas.
Permite crear formularios con botones de comandos, cuadros de
texto y muchos otros controles y enlazarlos a base de datos.
Lenguaje de programacion sencillo para plataformas libres (como
GNU/Linux y BSD).
Este ejemplo nos permite realizar una resta.
PUBLIC SUB Main()
DIM a AS Integer
DIM b, r AS Integer
a = 50
b = 20
r = a - b
PRINT "la resta es"
PRINT "r"

END

Este programa nos permite encontrar el total de quintales.
EL Ecuador exporta café, cacao y maiz.
PUBLIC SUB Main()
DIM A, c, fe, m, s, p1, p2, p3 AS Integer
PRINT "ingrese una cantidad"
INPUT A
INPUT c, fe, m
PRINT "lo que ingreso es.....", A
PRINT "ingrese la cantidad de cacao"
INPUT c
PRINT "ingrese la cantidad de café"
INPUT fe
PRINT "ingrese la cantidad de maiz"
INPUT m
s = c + fe + m
p1 = (c * 100) / s
p2 = (fe * 100) / s
p3 = (m * 100) / s
PRINT "el total de importaciones es"
PRINT "el quintal de cacao es", & srt(s) & "entre p1 y p3"
PRINT "el quintal de café es"
PRINT "el quintal de maiz es"
END
Este programa nos permite conoser que número es Mayor, Menor, y
Medio
PUBLIC SUB Main()
DIM a, b, c AS Integer
PRINT "Ingrese primer valor A:"
INPUT a
PRINT "Ingrese segundo valor B:"
INPUT b
PRINT "Ingrese tercer valor C:"
INPUT c
IF ((a > b) AND (a > c)) THEN
  PRINT "Mayor", a
  IF (b > c) THEN
    PRINT "Medio", b
    PRINT "Menor", c
  ELSE
    PRINT "Medio", c
    PRINT "Menor", b
  ENDIF
ENDIF
IF ((b > c) AND (b > a)) THEN
  PRINT "Mayor", b
  IF (a > c) THEN
    PRINT "Medio", a
    PRINT "Menor", c
  ELSE
    PRINT "Medio", c
    PRINT "Menor", a
  ENDIF
ENDIF
IF ((c > b) AND (c > a)) THEN
  PRINT "Mayor", c
  IF (b > a) THEN
    PRINT "Medio", b
    PRINT "Menor", a
  ELSE
    PRINT "Medio", a
    PRINT "Menor", b
  ENDIF
ENDIF
END
Este ejercicio nos permite ingresar los datos de un estudiante con
mucha facilidad.
PRIVATE Promedio AS String
PRIVATE FechaMatricula AS Date
PRIVATE Nombre AS String
PRIVATE Apellido AS String
PRIVATE Nota1 AS Single
PRIVATE nota2 AS Single
PRIVATE nota3 AS Single

PUBLIC SUB notaUno(numero AS Integer)
  Nota1 = numero
END

PUBLIC SUB notaDos(numero AS Integer)
  nota2 = numero
END

PUBLIC SUB notaTres(numero AS Integer)
  nota3 = numero
END

PUBLIC FUNCTION PromedioFinal() AS Single
  RETURN (nota1 + nota2 + nota3) / 3
 END

PUBLIC FUNCTION fechama(fecha AS Date) AS Date
  FechaMatricula = fecha
  RETURN FechaMatricula
END

PUBLIC SUB PoneNombre(cadena AS String)
  Nombre = cadena
END

PUBLIC SUB PoneApellido(cadena AS String)
  Apellido = cadena
END

PUBLIC FUNCTION NombreCompleto() AS String
  RETURN Nombre & "" & Apellido
END
LA CALCULADORA
Este es un programa que nos permite realizar   las funciones de
una calculadora.




 Gambas class file
PUBLIC ban AS Integer
PUBLIC aux1 AS Integer
PUBLIC aux2 AS Integer
PUBLIC SUB _new()


END

PUBLIC SUB button1_Click()

  visor.Text = visor.Text & "1"

END

PUBLIC SUB Button4_Click()

   visor.Text = visor.Text & "4"


END
PUBLIC SUB Button2_Click()

   visor.Text = visor.Text & "2"

END

PUBLIC SUB Button3_Click()

   visor.Text = visor.Text & "3"

END

PUBLIC SUB Button5_Click()

   visor.Text = visor.Text & "5"

END

PUBLIC SUB Button6_Click()

   visor.Text = visor.Text & "6"

END

PUBLIC SUB Button7_Click()

   visor.Text = visor.Text & "7"

END

PUBLIC SUB Button8_Click()

   visor.Text = visor.Text & "8"

END

PUBLIC SUB Button9_Click()

   visor.Text = visor.Text & "9"

END

PUBLIC SUB Button10_Click()

   visor.Text = visor.Text & "0"
END

PUBLIC SUB Button11_Click()

   visor.Text = visor.Text & "."

END


PUBLIC SUB Button17_Click()

  visor.Clear

END

PUBLIC SUB Button18_Click()

  ME.Close

END

PUBLIC SUB Button13_Click()

  ban = 1
    IF visor.Text <> 0 THEN
    aux1 = visor.Text
    ELSE
      aux1 = 0
      ENDIF
      visor.Clear

END

PUBLIC SUB Button14_Click()

  ban = 2
    IF visor.Text <> 0 THEN
    aux1 = visor.Text
    ELSE
      aux1 = 0
      ENDIF
      visor.Clear

END
PUBLIC SUB Button15_Click()

  ban = 3
    IF visor.Text <> 0 THEN
    aux1 = visor.Text
    ELSE
      aux1 = 0
      ENDIF
      visor.Clear

END

PUBLIC SUB Button16_Click()

  ban = 4
    IF visor.Text <> 0 THEN
    aux1 = visor.Text
    ELSE
      aux1 = 0
      ENDIF
      visor.Clear

END

PUBLIC SUB Button20_Click()

  IF visor.Text <> 0 THEN
    aux2 = visor.Text
     ELSE
     aux2 = 0
     ENDIF
     visor.Text = operaciones(ban, aux1, aux2)
END
PUBLIC FUNCTION operaciones(opera AS Integer, v1 AS Integer, v2 AS
Integer) AS Integer
  DIM respuesta AS Integer
  SELECT CASE opera
  CASE 1
     respuesta = v1 + v2
  CASE 2
  respuesta = v1 - v2
  CASE 3
  respuesta = v1 * v2
  CASE 4
respuesta = v1 / v2

  END SELECT
  RETURN respuesta

END

PUBLIC SUB Button31_Click()
DIM n, i, x1, x2 AS Integer
DIM cadena, cadena2 AS String
  n = visor.Text
  WHILE n > 0
  x1 = (Int(n / 2))
  x2 = n MOD 2
  cadena = cadena & Str(x2)
  n = x1
  WEND
  FOR i = Len(cadena) TO 1 STEP -1
  cadena2 = cadena2 & Mid(cadena, i, 1)
  NEXT
  visor.Text = cadena2
  Messsage("el resultado es.....", "aceptar")




END

PUBLIC SUB Button32_Click()


DIM n, x1, x2, j AS Integer
DIM cadena, cadena2 AS String
n = visor.text
WHILE n > 0
x1 = (Int(n / 8))
x2 = n MOD 8
cadena = cadena & Str(x2)
n = x1
WEND
FOR j = Len(cadena) TO 1 STEP -1
cadena2 = cadena2 & Mid(cadena, j, 1)
NEXT
visor.text = cadena2
END
PUBLIC SUB Button23_Click()
visor.text = Sin(visor.text)




END

PUBLIC SUB Button24_Click()
visor.text = Cos(visor.text)


END

PUBLIC SUB Button25_Click()

  visor.text = Tan(visor.text)

END

PUBLIC SUB Button12_Click()

  visor.text = visor.text * visor.text

END

PUBLIC SUB Button19_Click()

  visor.text = visor.text * visor.text * visor.text

END

PUBLIC SUB Button33_Click()

DIM n, i, x1, x2 AS Integer
  DIM cadena, cadena2 AS String
  n = visor.Text
  WHILE n > 0
    x1 = (Int(n / 16))
    x2 = n MOD 16
    IF x2 < 10 THEN
     cadena = cadena & Str(x2)
    ELSE IF x2 = 10 THEN
     cadena = cadena & "A"
     ELSE IF X2 = 11 THEN
cadena = cadena & "B"
      ELSE IF x2 = 12 THEN
       cadena = cadena & "C"
       ELSE IF X2 = 13 THEN
       cadena = cadena & "D"
      ELSE IF x2 = 14 THEN
       cadena = cadena & "E"
       ELSE IF X2 = 15 THEN
       cadena = cadena & "F"
      ENDIF
           n = x1
      WEND
      FOR i = Len(cadena) TO 1 STEP -1
      cadena2 = cadena2 & Mid(cadena, i, 1)
      NEXT
      visor.Text = cadena2


END

PUBLIC SUB Button21_Click()




END

PUBLIC SUB Button27_Click()




END

PUBLIC SUB Button28_Click()




END
Este ejemplo nos permite hacer el ingreso de productos como a su
vez nos permite visualizar el estandar de productos existentes en
nuestra base de datos.




Gambas class file
PUBLIC con AS Integer
PUBLIC fil AS Integer
PUBLIC col AS Integer
PUBLIC SUB Form_Open()
modulo.conectar
modulo.rs = modulo.cn.Exec("select * from producto")
mostrar()
END

PUBLIC SUB Button5_Click()
ME.Close
END
'guarda

PUBLIC SUB Button9_Click()
TRY modulo.cn.Exec("insert into producto values('" &
Trim(UCase(TextBox8.Text)) & "','" & Trim(UCase(TextBox7.Text)) &
"','" & (TextBox6.Text) & "','" & (ValueBox1.Text) & "');")
IF ERROR THEN
Message.Error("Imposible insertar el registro")
ELSE
Message.Info("Registro insertado")
END IF
modulo.rs = modulo.cn.Exec("Select * from producto")
mostrar()
desabilitar()

END

PUBLIC SUB desabilitar()
  TextBox8.Enabled = FALSE
  TextBox7.Enabled = FALSE
  TextBox6.Enabled = FALSE
  ValueBox1.Enabled = FALSE
    END

PUBLIC SUB mostrar()
modulo.rs.MoveFirst
IF modulo.rs.Count > 0 THEN
Grid1.Columns.Count = 4
Grid1.Rows.Count = modulo.rs.Count + 1
Grid1.Columns[0].Width = 60
Grid1.Columns[1].Width = 180
Grid1.Columns[2].Width = 80
Grid1.Columns[3].Width = 80
Grid1[0, 0].Text = "Codigo"
Grid1[0, 1].Text = "Nombre"
Grid1[0, 2].Text = "Cantidad"
Grid1[0, 3].Text = "Precio Unitario"
fil = 1
modulo.rs.MoveFirst
'con = Modulo.rs.Count
DO WHILE modulo.rs.Available

Grid1[fil, 0].Text =   modulo.rs["codigo"]
Grid1[fil, 1].Text =   modulo.rs["nombre"]
Grid1[fil, 2].Text =   modulo.rs["precio"]
Grid1[fil, 3].Text =   modulo.rs["cantidad"]
fil = fil + 1
modulo.rs.MoveNext()
LOOP
ENDIF

END
PUBLIC SUB Button10_Click()

SELECT Message.Question("Desea eliminar un Producto", "Si", "No")
CASE 1
TRY modulo.cn.Exec("Delete from producto where codigo='" &
Trim(UCase(TextBox8.Text)) & "'")
IF ERROR THEN
Message.Error("Imposible borrar el registro")
ELSE
modulo.rs = modulo.cn.Exec("select * from producto")
mostrar()

END IF
CASE 2
Message.Info("Registro no eliminado")
CASE 3
END SELECT
'limpiar()

END


PUBLIC SUB Button11_Click()

TRY Modulo.cn.Exec("update producto set nombre='" &
Trim(UCase(TextBox7.Text)) & "',precio='" &
Trim(UCase(TextBox6.Text)) & "',cantidad='" &
Trim(UCase(ValueBox1.Text)) & "' where=textbox8.text ")
IF ERROR THEN
Message.Error("Imposible actualizar el registro")
ELSE
Message.Info("Registro actualizado")
END IF

mostrar
'LIMPIAR

END


PUBLIC SUB Button8_Click()

TextBox8.Clear
TextBox7.Clear
TextBox6.Clear
TextBox6.Text = 0
ValueBox1.Clear
abilitar()
END


PUBLIC SUB abilitar()
  TextBox8.Enabled = TRUE
  TextBox7.Enabled = TRUE
  TextBox6.Enabled = TRUE
  ValueBox1.Enabled = TRUE
    END
PUBLIC SUB Grid1_Click()

IF Grid1.Current = NULL THEN RETURN
SELECT Message.Question("Desea eliminar un producto", "Si", "No",
"Ayuda")
CASE 1
TRY modulo.cn.Exec("Delete from producto where codigo='" &
Trim(UCase(Grid1.Current.Text)) & "'")
IF ERROR THEN
Message.Error("Imposible borrar el registro")
ELSE
modulo.rs = modulo.cn.Exec("select * from producto")
mostrar()

END IF
CASE 2
Message.Info("Registro no eliminado")

END SELECT

END

PUBLIC SUB Button7_Click()
DIM ban AS Integer
Modulo.rs = Modulo.cn.Exec("select * from producto")
DO WHILE Modulo.rs.Available

IF modulo.rs["codigo"] = Trim(UCase(TextBox8.Text)) THEN
Modulo.rs = Modulo.cn.Exec("select * from producto where codigo =
'" & Trim(UCase(TextBox8.Text)) & "'")
TextBox7.Text = Modulo.rs["nombre"]
TextBox6.Text = Modulo.rs["precio"]
ValueBox1.Value = Modulo.rs["cantidad"]
ban = 1
ENDIF
MODULO.rs.MoveNext()
LOOP
IF ban = 0 THEN
Message.Error("Registro Invalido")
'limpiar()
END IF

END

PUBLIC SUB Button1_Click()

  ME.Close

END
PUBLIC SUB TextBox7_KeyPress()
IF Key.code = 65293 THEN
IF TextBox7.Text = "" THEN
Message.Info("iNGRESE NOMBRE DE PRODUCTO0...")
TextBox7.Select
ELSE
TextBox6.SetFocus
ENDIF
  ENDIF

 END

PUBLIC SUB TextBox6_KeyPress()

  IF Key.code = 65293 THEN
  IF TextBox6.Text = "" THEN
Message.Info("PRECIO DEL PRODUCTO0...")
TextBox6.Select
ELSE
ValueBox1.SetFocus
ENDIF
  ENDIF


END

PUBLIC SUB ValueBox1_KeyPress()
IF Key.code = 65293 THEN
  IF ValueBox1 = "" THEN
Message.Info("INGRESE CANTIDAD DEL PRODUCTO0...")
ValueBox1.Select
ELSE
TextBox8.SetFocus
ENDIF
  ENDIF


END

More Related Content

What's hot

Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subirguest9da3a3
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subirguest9da3a3
 
Burger doll order form
Burger doll order formBurger doll order form
Burger doll order formKhairi Aiman
 
Codigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De GambasCodigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De Gambasmikyken
 
The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88Mahmoud Samir Fayed
 
TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...
TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...
TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...tdc-globalcode
 
Calculadora
CalculadoraCalculadora
CalculadoraCBTa 120
 
Pre-Bootcamp introduction to Elixir
Pre-Bootcamp introduction to ElixirPre-Bootcamp introduction to Elixir
Pre-Bootcamp introduction to ElixirPaweł Dawczak
 
Database Management - Lecture 3 - SQL Aggregate Functions, Join
Database Management - Lecture 3 - SQL Aggregate Functions, JoinDatabase Management - Lecture 3 - SQL Aggregate Functions, Join
Database Management - Lecture 3 - SQL Aggregate Functions, JoinAl-Mamun Sarkar
 

What's hot (15)

Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Burger doll order form
Burger doll order formBurger doll order form
Burger doll order form
 
Gambas
Gambas Gambas
Gambas
 
Draw2D
Draw2DDraw2D
Draw2D
 
Codigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De GambasCodigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De Gambas
 
The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184
 
The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88
 
Writeable CTEs: The Next Big Thing
Writeable CTEs: The Next Big ThingWriteable CTEs: The Next Big Thing
Writeable CTEs: The Next Big Thing
 
Ensayo
EnsayoEnsayo
Ensayo
 
TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...
TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...
TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...
 
Area de un triangulo
Area de un trianguloArea de un triangulo
Area de un triangulo
 
Calculadora
CalculadoraCalculadora
Calculadora
 
Pre-Bootcamp introduction to Elixir
Pre-Bootcamp introduction to ElixirPre-Bootcamp introduction to Elixir
Pre-Bootcamp introduction to Elixir
 
Database Management - Lecture 3 - SQL Aggregate Functions, Join
Database Management - Lecture 3 - SQL Aggregate Functions, JoinDatabase Management - Lecture 3 - SQL Aggregate Functions, Join
Database Management - Lecture 3 - SQL Aggregate Functions, Join
 

Viewers also liked

On Off Study (in Russisch)
On Off Study (in Russisch)On Off Study (in Russisch)
On Off Study (in Russisch)Dmitry Pankov
 
1053 Apprendre1 (2)
1053 Apprendre1 (2)1053 Apprendre1 (2)
1053 Apprendre1 (2)guest8ccba72
 
Architect Dec By Infoq
Architect  Dec By InfoqArchitect  Dec By Infoq
Architect Dec By Infoqliu qiang
 
7 Habits Of Successful Teens
7 Habits Of Successful Teens7 Habits Of Successful Teens
7 Habits Of Successful TeensDevon
 
Arquitectura Especial
Arquitectura EspecialArquitectura Especial
Arquitectura Especialpercy
 
Operations Research Sondaj de opinie national – ANALIZA COMPARATIVA
Operations Research Sondaj de opinie national – ANALIZA COMPARATIVAOperations Research Sondaj de opinie national – ANALIZA COMPARATIVA
Operations Research Sondaj de opinie national – ANALIZA COMPARATIVAinpolitics
 
Connect Remotely Using Windows® 7 Direct Access
Connect Remotely Using Windows® 7 Direct AccessConnect Remotely Using Windows® 7 Direct Access
Connect Remotely Using Windows® 7 Direct AccessMicrosoft TechNet
 
Cursus Klassiek Arabisch
Cursus Klassiek ArabischCursus Klassiek Arabisch
Cursus Klassiek ArabischLearning centre
 
Web 3.0: Semantic Web - Chancen für E-Commerce Anbieter im Web of Data
Web 3.0: Semantic Web - Chancen für E-Commerce Anbieter im Web of DataWeb 3.0: Semantic Web - Chancen für E-Commerce Anbieter im Web of Data
Web 3.0: Semantic Web - Chancen für E-Commerce Anbieter im Web of DataMarkus Linder
 
NYU Center for Publishing
NYU Center for PublishingNYU Center for Publishing
NYU Center for PublishingDebbie Stier
 
Lifetime warranty on dental implant procedure 
Lifetime warranty on dental implant procedure Lifetime warranty on dental implant procedure 
Lifetime warranty on dental implant procedure dentalimplantsindia
 
Article: From Best Practice to Success Transfer
Article:  From Best Practice to Success TransferArticle:  From Best Practice to Success Transfer
Article: From Best Practice to Success Transferrepner
 
上班族賺錢密碼
上班族賺錢密碼上班族賺錢密碼
上班族賺錢密碼sunny621201
 

Viewers also liked (20)

Building Your Policy Campaign From Grassroots to Grass Tops
Building Your Policy Campaign From Grassroots to Grass TopsBuilding Your Policy Campaign From Grassroots to Grass Tops
Building Your Policy Campaign From Grassroots to Grass Tops
 
On Off Study (in Russisch)
On Off Study (in Russisch)On Off Study (in Russisch)
On Off Study (in Russisch)
 
1053 Apprendre1 (2)
1053 Apprendre1 (2)1053 Apprendre1 (2)
1053 Apprendre1 (2)
 
Rola Prostytutki
Rola ProstytutkiRola Prostytutki
Rola Prostytutki
 
One God
One GodOne God
One God
 
Intro to Twitter
Intro to TwitterIntro to Twitter
Intro to Twitter
 
Architect Dec By Infoq
Architect  Dec By InfoqArchitect  Dec By Infoq
Architect Dec By Infoq
 
7 Habits Of Successful Teens
7 Habits Of Successful Teens7 Habits Of Successful Teens
7 Habits Of Successful Teens
 
Arquitectura Especial
Arquitectura EspecialArquitectura Especial
Arquitectura Especial
 
Operations Research Sondaj de opinie national – ANALIZA COMPARATIVA
Operations Research Sondaj de opinie national – ANALIZA COMPARATIVAOperations Research Sondaj de opinie national – ANALIZA COMPARATIVA
Operations Research Sondaj de opinie national – ANALIZA COMPARATIVA
 
Connect Remotely Using Windows® 7 Direct Access
Connect Remotely Using Windows® 7 Direct AccessConnect Remotely Using Windows® 7 Direct Access
Connect Remotely Using Windows® 7 Direct Access
 
Cursus Klassiek Arabisch
Cursus Klassiek ArabischCursus Klassiek Arabisch
Cursus Klassiek Arabisch
 
resume
resumeresume
resume
 
Web 3.0: Semantic Web - Chancen für E-Commerce Anbieter im Web of Data
Web 3.0: Semantic Web - Chancen für E-Commerce Anbieter im Web of DataWeb 3.0: Semantic Web - Chancen für E-Commerce Anbieter im Web of Data
Web 3.0: Semantic Web - Chancen für E-Commerce Anbieter im Web of Data
 
Media Relations For PR Playbook 3rd Edition
Media Relations For PR Playbook 3rd EditionMedia Relations For PR Playbook 3rd Edition
Media Relations For PR Playbook 3rd Edition
 
NYU Center for Publishing
NYU Center for PublishingNYU Center for Publishing
NYU Center for Publishing
 
Lifetime warranty on dental implant procedure 
Lifetime warranty on dental implant procedure Lifetime warranty on dental implant procedure 
Lifetime warranty on dental implant procedure 
 
Article: From Best Practice to Success Transfer
Article:  From Best Practice to Success TransferArticle:  From Best Practice to Success Transfer
Article: From Best Practice to Success Transfer
 
上班族賺錢密碼
上班族賺錢密碼上班族賺錢密碼
上班族賺錢密碼
 
David Guetta
David GuettaDavid Guetta
David Guetta
 

Similar to Yolygambas

Programas Gambas
Programas GambasProgramas Gambas
Programas GambasRZYMJ
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subirguest9da3a3
 
Codigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De GambasCodigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De Gambasmikyken
 
ANSHUL RANA - PROGRAM FILE.pptx
ANSHUL RANA - PROGRAM FILE.pptxANSHUL RANA - PROGRAM FILE.pptx
ANSHUL RANA - PROGRAM FILE.pptxjeyel85227
 
Algorithms and Flowcharts
Algorithms and FlowchartsAlgorithms and Flowcharts
Algorithms and FlowchartsDeva Singh
 
03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developerAndrea Antonello
 
Algorithmsandflowcharts1
Algorithmsandflowcharts1Algorithmsandflowcharts1
Algorithmsandflowcharts1rajnidhiman
 
PART 3: THE SCRIPTING COMPOSER AND PYTHON
PART 3: THE SCRIPTING COMPOSER AND PYTHONPART 3: THE SCRIPTING COMPOSER AND PYTHON
PART 3: THE SCRIPTING COMPOSER AND PYTHONAndrea Antonello
 
List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAPsapdocs. info
 
01 Algorithms And Flowcharts.ppt
01 Algorithms And Flowcharts.ppt01 Algorithms And Flowcharts.ppt
01 Algorithms And Flowcharts.pptFerdieBalang
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowchartsSamuel Igbanogu
 

Similar to Yolygambas (20)

Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Codigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De GambasCodigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De Gambas
 
Calculadora
CalculadoraCalculadora
Calculadora
 
Calculadora
CalculadoraCalculadora
Calculadora
 
Calculadora
CalculadoraCalculadora
Calculadora
 
ANSHUL RANA - PROGRAM FILE.pptx
ANSHUL RANA - PROGRAM FILE.pptxANSHUL RANA - PROGRAM FILE.pptx
ANSHUL RANA - PROGRAM FILE.pptx
 
Ejercicios
EjerciciosEjercicios
Ejercicios
 
Ejercicios
EjerciciosEjercicios
Ejercicios
 
Ejerciciosdeprogramacion
EjerciciosdeprogramacionEjerciciosdeprogramacion
Ejerciciosdeprogramacion
 
Algorithmsandflowcharts1
Algorithmsandflowcharts1Algorithmsandflowcharts1
Algorithmsandflowcharts1
 
Algorithms and Flowcharts
Algorithms and FlowchartsAlgorithms and Flowcharts
Algorithms and Flowcharts
 
03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer
 
Algorithmsandflowcharts1
Algorithmsandflowcharts1Algorithmsandflowcharts1
Algorithmsandflowcharts1
 
Algorithmsandflowcharts1
Algorithmsandflowcharts1Algorithmsandflowcharts1
Algorithmsandflowcharts1
 
PART 3: THE SCRIPTING COMPOSER AND PYTHON
PART 3: THE SCRIPTING COMPOSER AND PYTHONPART 3: THE SCRIPTING COMPOSER AND PYTHON
PART 3: THE SCRIPTING COMPOSER AND PYTHON
 
List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAP
 
01 Algorithms And Flowcharts.ppt
01 Algorithms And Flowcharts.ppt01 Algorithms And Flowcharts.ppt
01 Algorithms And Flowcharts.ppt
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
 

Recently uploaded

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 

Recently uploaded (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 

Yolygambas

  • 1. Gambas Es un lenguaje de programacion libre derivado de Basic.Se distribuye con licencia GNU GPL. Cabe destacar que presenta ciertas similitudes con javas ya que en la ejecución de cualquier aplicación, se requiere un conjunto de librerías interprete previamente instaladas. Permite crear formularios con botones de comandos, cuadros de texto y muchos otros controles y enlazarlos a base de datos. Lenguaje de programacion sencillo para plataformas libres (como GNU/Linux y BSD). Este ejemplo nos permite realizar una resta. PUBLIC SUB Main() DIM a AS Integer DIM b, r AS Integer a = 50 b = 20 r = a - b PRINT "la resta es" PRINT "r" END Este programa nos permite encontrar el total de quintales. EL Ecuador exporta café, cacao y maiz. PUBLIC SUB Main() DIM A, c, fe, m, s, p1, p2, p3 AS Integer PRINT "ingrese una cantidad" INPUT A INPUT c, fe, m PRINT "lo que ingreso es.....", A PRINT "ingrese la cantidad de cacao" INPUT c PRINT "ingrese la cantidad de café" INPUT fe PRINT "ingrese la cantidad de maiz" INPUT m s = c + fe + m p1 = (c * 100) / s p2 = (fe * 100) / s p3 = (m * 100) / s PRINT "el total de importaciones es" PRINT "el quintal de cacao es", & srt(s) & "entre p1 y p3" PRINT "el quintal de café es" PRINT "el quintal de maiz es" END
  • 2. Este programa nos permite conoser que número es Mayor, Menor, y Medio PUBLIC SUB Main() DIM a, b, c AS Integer PRINT "Ingrese primer valor A:" INPUT a PRINT "Ingrese segundo valor B:" INPUT b PRINT "Ingrese tercer valor C:" INPUT c IF ((a > b) AND (a > c)) THEN PRINT "Mayor", a IF (b > c) THEN PRINT "Medio", b PRINT "Menor", c ELSE PRINT "Medio", c PRINT "Menor", b ENDIF ENDIF IF ((b > c) AND (b > a)) THEN PRINT "Mayor", b IF (a > c) THEN PRINT "Medio", a PRINT "Menor", c ELSE PRINT "Medio", c PRINT "Menor", a ENDIF ENDIF IF ((c > b) AND (c > a)) THEN PRINT "Mayor", c IF (b > a) THEN PRINT "Medio", b PRINT "Menor", a ELSE PRINT "Medio", a PRINT "Menor", b ENDIF ENDIF END
  • 3. Este ejercicio nos permite ingresar los datos de un estudiante con mucha facilidad. PRIVATE Promedio AS String PRIVATE FechaMatricula AS Date PRIVATE Nombre AS String PRIVATE Apellido AS String PRIVATE Nota1 AS Single PRIVATE nota2 AS Single PRIVATE nota3 AS Single PUBLIC SUB notaUno(numero AS Integer) Nota1 = numero END PUBLIC SUB notaDos(numero AS Integer) nota2 = numero END PUBLIC SUB notaTres(numero AS Integer) nota3 = numero END PUBLIC FUNCTION PromedioFinal() AS Single RETURN (nota1 + nota2 + nota3) / 3 END PUBLIC FUNCTION fechama(fecha AS Date) AS Date FechaMatricula = fecha RETURN FechaMatricula END PUBLIC SUB PoneNombre(cadena AS String) Nombre = cadena END PUBLIC SUB PoneApellido(cadena AS String) Apellido = cadena END PUBLIC FUNCTION NombreCompleto() AS String RETURN Nombre & "" & Apellido END
  • 4. LA CALCULADORA Este es un programa que nos permite realizar las funciones de una calculadora. Gambas class file PUBLIC ban AS Integer PUBLIC aux1 AS Integer PUBLIC aux2 AS Integer PUBLIC SUB _new() END PUBLIC SUB button1_Click() visor.Text = visor.Text & "1" END PUBLIC SUB Button4_Click() visor.Text = visor.Text & "4" END
  • 5. PUBLIC SUB Button2_Click() visor.Text = visor.Text & "2" END PUBLIC SUB Button3_Click() visor.Text = visor.Text & "3" END PUBLIC SUB Button5_Click() visor.Text = visor.Text & "5" END PUBLIC SUB Button6_Click() visor.Text = visor.Text & "6" END PUBLIC SUB Button7_Click() visor.Text = visor.Text & "7" END PUBLIC SUB Button8_Click() visor.Text = visor.Text & "8" END PUBLIC SUB Button9_Click() visor.Text = visor.Text & "9" END PUBLIC SUB Button10_Click() visor.Text = visor.Text & "0"
  • 6. END PUBLIC SUB Button11_Click() visor.Text = visor.Text & "." END PUBLIC SUB Button17_Click() visor.Clear END PUBLIC SUB Button18_Click() ME.Close END PUBLIC SUB Button13_Click() ban = 1 IF visor.Text <> 0 THEN aux1 = visor.Text ELSE aux1 = 0 ENDIF visor.Clear END PUBLIC SUB Button14_Click() ban = 2 IF visor.Text <> 0 THEN aux1 = visor.Text ELSE aux1 = 0 ENDIF visor.Clear END
  • 7. PUBLIC SUB Button15_Click() ban = 3 IF visor.Text <> 0 THEN aux1 = visor.Text ELSE aux1 = 0 ENDIF visor.Clear END PUBLIC SUB Button16_Click() ban = 4 IF visor.Text <> 0 THEN aux1 = visor.Text ELSE aux1 = 0 ENDIF visor.Clear END PUBLIC SUB Button20_Click() IF visor.Text <> 0 THEN aux2 = visor.Text ELSE aux2 = 0 ENDIF visor.Text = operaciones(ban, aux1, aux2) END PUBLIC FUNCTION operaciones(opera AS Integer, v1 AS Integer, v2 AS Integer) AS Integer DIM respuesta AS Integer SELECT CASE opera CASE 1 respuesta = v1 + v2 CASE 2 respuesta = v1 - v2 CASE 3 respuesta = v1 * v2 CASE 4
  • 8. respuesta = v1 / v2 END SELECT RETURN respuesta END PUBLIC SUB Button31_Click() DIM n, i, x1, x2 AS Integer DIM cadena, cadena2 AS String n = visor.Text WHILE n > 0 x1 = (Int(n / 2)) x2 = n MOD 2 cadena = cadena & Str(x2) n = x1 WEND FOR i = Len(cadena) TO 1 STEP -1 cadena2 = cadena2 & Mid(cadena, i, 1) NEXT visor.Text = cadena2 Messsage("el resultado es.....", "aceptar") END PUBLIC SUB Button32_Click() DIM n, x1, x2, j AS Integer DIM cadena, cadena2 AS String n = visor.text WHILE n > 0 x1 = (Int(n / 8)) x2 = n MOD 8 cadena = cadena & Str(x2) n = x1 WEND FOR j = Len(cadena) TO 1 STEP -1 cadena2 = cadena2 & Mid(cadena, j, 1) NEXT visor.text = cadena2 END
  • 9. PUBLIC SUB Button23_Click() visor.text = Sin(visor.text) END PUBLIC SUB Button24_Click() visor.text = Cos(visor.text) END PUBLIC SUB Button25_Click() visor.text = Tan(visor.text) END PUBLIC SUB Button12_Click() visor.text = visor.text * visor.text END PUBLIC SUB Button19_Click() visor.text = visor.text * visor.text * visor.text END PUBLIC SUB Button33_Click() DIM n, i, x1, x2 AS Integer DIM cadena, cadena2 AS String n = visor.Text WHILE n > 0 x1 = (Int(n / 16)) x2 = n MOD 16 IF x2 < 10 THEN cadena = cadena & Str(x2) ELSE IF x2 = 10 THEN cadena = cadena & "A" ELSE IF X2 = 11 THEN
  • 10. cadena = cadena & "B" ELSE IF x2 = 12 THEN cadena = cadena & "C" ELSE IF X2 = 13 THEN cadena = cadena & "D" ELSE IF x2 = 14 THEN cadena = cadena & "E" ELSE IF X2 = 15 THEN cadena = cadena & "F" ENDIF n = x1 WEND FOR i = Len(cadena) TO 1 STEP -1 cadena2 = cadena2 & Mid(cadena, i, 1) NEXT visor.Text = cadena2 END PUBLIC SUB Button21_Click() END PUBLIC SUB Button27_Click() END PUBLIC SUB Button28_Click() END
  • 11. Este ejemplo nos permite hacer el ingreso de productos como a su vez nos permite visualizar el estandar de productos existentes en nuestra base de datos. Gambas class file PUBLIC con AS Integer PUBLIC fil AS Integer PUBLIC col AS Integer PUBLIC SUB Form_Open() modulo.conectar modulo.rs = modulo.cn.Exec("select * from producto") mostrar() END PUBLIC SUB Button5_Click() ME.Close END 'guarda PUBLIC SUB Button9_Click() TRY modulo.cn.Exec("insert into producto values('" & Trim(UCase(TextBox8.Text)) & "','" & Trim(UCase(TextBox7.Text)) & "','" & (TextBox6.Text) & "','" & (ValueBox1.Text) & "');") IF ERROR THEN
  • 12. Message.Error("Imposible insertar el registro") ELSE Message.Info("Registro insertado") END IF modulo.rs = modulo.cn.Exec("Select * from producto") mostrar() desabilitar() END PUBLIC SUB desabilitar() TextBox8.Enabled = FALSE TextBox7.Enabled = FALSE TextBox6.Enabled = FALSE ValueBox1.Enabled = FALSE END PUBLIC SUB mostrar() modulo.rs.MoveFirst IF modulo.rs.Count > 0 THEN Grid1.Columns.Count = 4 Grid1.Rows.Count = modulo.rs.Count + 1 Grid1.Columns[0].Width = 60 Grid1.Columns[1].Width = 180 Grid1.Columns[2].Width = 80 Grid1.Columns[3].Width = 80 Grid1[0, 0].Text = "Codigo" Grid1[0, 1].Text = "Nombre" Grid1[0, 2].Text = "Cantidad" Grid1[0, 3].Text = "Precio Unitario" fil = 1 modulo.rs.MoveFirst 'con = Modulo.rs.Count DO WHILE modulo.rs.Available Grid1[fil, 0].Text = modulo.rs["codigo"] Grid1[fil, 1].Text = modulo.rs["nombre"] Grid1[fil, 2].Text = modulo.rs["precio"] Grid1[fil, 3].Text = modulo.rs["cantidad"] fil = fil + 1 modulo.rs.MoveNext() LOOP ENDIF END
  • 13. PUBLIC SUB Button10_Click() SELECT Message.Question("Desea eliminar un Producto", "Si", "No") CASE 1 TRY modulo.cn.Exec("Delete from producto where codigo='" & Trim(UCase(TextBox8.Text)) & "'") IF ERROR THEN Message.Error("Imposible borrar el registro") ELSE modulo.rs = modulo.cn.Exec("select * from producto") mostrar() END IF CASE 2 Message.Info("Registro no eliminado") CASE 3 END SELECT 'limpiar() END PUBLIC SUB Button11_Click() TRY Modulo.cn.Exec("update producto set nombre='" & Trim(UCase(TextBox7.Text)) & "',precio='" & Trim(UCase(TextBox6.Text)) & "',cantidad='" & Trim(UCase(ValueBox1.Text)) & "' where=textbox8.text ") IF ERROR THEN Message.Error("Imposible actualizar el registro") ELSE Message.Info("Registro actualizado") END IF mostrar 'LIMPIAR END PUBLIC SUB Button8_Click() TextBox8.Clear
  • 14. TextBox7.Clear TextBox6.Clear TextBox6.Text = 0 ValueBox1.Clear abilitar() END PUBLIC SUB abilitar() TextBox8.Enabled = TRUE TextBox7.Enabled = TRUE TextBox6.Enabled = TRUE ValueBox1.Enabled = TRUE END PUBLIC SUB Grid1_Click() IF Grid1.Current = NULL THEN RETURN SELECT Message.Question("Desea eliminar un producto", "Si", "No", "Ayuda") CASE 1 TRY modulo.cn.Exec("Delete from producto where codigo='" & Trim(UCase(Grid1.Current.Text)) & "'") IF ERROR THEN Message.Error("Imposible borrar el registro") ELSE modulo.rs = modulo.cn.Exec("select * from producto") mostrar() END IF CASE 2 Message.Info("Registro no eliminado") END SELECT END PUBLIC SUB Button7_Click() DIM ban AS Integer Modulo.rs = Modulo.cn.Exec("select * from producto") DO WHILE Modulo.rs.Available IF modulo.rs["codigo"] = Trim(UCase(TextBox8.Text)) THEN Modulo.rs = Modulo.cn.Exec("select * from producto where codigo = '" & Trim(UCase(TextBox8.Text)) & "'") TextBox7.Text = Modulo.rs["nombre"]
  • 15. TextBox6.Text = Modulo.rs["precio"] ValueBox1.Value = Modulo.rs["cantidad"] ban = 1 ENDIF MODULO.rs.MoveNext() LOOP IF ban = 0 THEN Message.Error("Registro Invalido") 'limpiar() END IF END PUBLIC SUB Button1_Click() ME.Close END PUBLIC SUB TextBox7_KeyPress() IF Key.code = 65293 THEN IF TextBox7.Text = "" THEN Message.Info("iNGRESE NOMBRE DE PRODUCTO0...") TextBox7.Select ELSE TextBox6.SetFocus ENDIF ENDIF END PUBLIC SUB TextBox6_KeyPress() IF Key.code = 65293 THEN IF TextBox6.Text = "" THEN Message.Info("PRECIO DEL PRODUCTO0...") TextBox6.Select ELSE ValueBox1.SetFocus ENDIF ENDIF END PUBLIC SUB ValueBox1_KeyPress()
  • 16. IF Key.code = 65293 THEN IF ValueBox1 = "" THEN Message.Info("INGRESE CANTIDAD DEL PRODUCTO0...") ValueBox1.Select ELSE TextBox8.SetFocus ENDIF ENDIF END