Protector de pantalla
PUBLIC C AS Integer
PUBLIC CO AS Integer
PUBLIC CV AS Integer

PUBLIC SUB _new()

END

PUBLIC SUB Form_Open()

END

PUBLIC SUB Timer1_Timer()

C = Int(Rnd() * 500)
CO = Int(Rnd() * 500)
CV = Int(Rnd() * 20)
Draw.Begin(area1)
Draw.FillColor = Color.RGB((250 + C), (3 + CO), (C + CO))
Draw.FillStyle = Fill.Solid
Draw.Circle(C, CO, CV)
Draw.End
END

PUBLIC SUB Button1_Click()

   IF Button1.Text = "Iniciar" THEN   
  Timer1.Enabled = TRUE
  Button1.Caption = "Parar"
  ELSE 
   Button1.Caption = "Iniciar"
   Timer1.Enabled = FALSE
   ENDIF 

END

PUBLIC SUB Button2_Click()


END
Calculadora
PUBLIC BAN AS Integer
PUBLIC OP1 AS Single
PUBLIC OP2 AS Single



PUBLIC SUB _new()

END

PUBLIC SUB Form_Open()

END

PUBLIC SUB Button1_Click()
 BAN = 1
 IF TextBox1.Text <> 0 THEN 
 OP1 = TextBox1.Text
 ELSE 
 OP1 = 0
 ENDIF 
TextBox1.Clear
END

PUBLIC SUB Button18_Click()

  ME.Close

END

PUBLIC SUB Button8_Click()
  TextBox1.Text = ""

END

PUBLIC SUB Button6_Click()

  TextBox1.Text = TextBox1.Text & "0"

END

PUBLIC SUB Button7_Click()

  TextBox1.Text = TextBox1.Text & "."

END

PUBLIC SUB Button9_Click()

  TextBox1.Text = TextBox1.Text & "1"

END

PUBLIC SUB Button10_Click()

  TextBox1.Text = TextBox1.Text & "2"

END

PUBLIC SUB Button11_Click()

  TextBox1.Text = TextBox1.Text & "3"

END

PUBLIC SUB Button12_Click()

  TextBox1.Text = TextBox1.Text & "4"

END

PUBLIC SUB Button13_Click()

  TextBox1.Text = TextBox1.Text & "5"

END

PUBLIC SUB Button14_Click()

  TextBox1.Text = TextBox1.Text & "6"
END

PUBLIC SUB Button15_Click()

  TextBox1.Text = TextBox1.Text & "7"

END

PUBLIC SUB Button16_Click()

  TextBox1.Text = TextBox1.Text & "8"

END

PUBLIC SUB Button17_Click()

  TextBox1.Text = TextBox1.Text & "9"

END

PUBLIC SUB TextBox1_KeyPress()

END

PUBLIC SUB Button2_Click()

   BAN = 2
 IF TextBox1.Text <> 0 THEN 
 OP1 = TextBox1.Text
 ELSE 
 OP1 = 0
 ENDIF 
TextBox1.Clear

END

PUBLIC SUB Button3_Click()

   BAN = 3
 IF TextBox1.Text <> 0 THEN 
 OP1 = TextBox1.Text
 ELSE 
 OP1 = 0
 ENDIF 
TextBox1.Clear

END

PUBLIC SUB Button4_Click()
   BAN = 4
 IF TextBox1.Text <> 0 THEN 
 OP1 = TextBox1.Text
 ELSE 
 OP1 = 0
 ENDIF 
TextBox1.Clear

END

PUBLIC SUB Button5_Click()

  IF TextBox1.Text <> 0 THEN 
  OP2 = Val(TextBox1.Text)
  ELSE 
  OP2 = 0
ENDIF 
TextBox1.Text = operacion(OP1, OP2, BAN)
END

PUBLIC FUNCTION operacion(v1 AS Float, v2 AS Float, opera AS Integer) AS Float

DIM re AS Single
DIM y2, x, y, z, x1, z2, y1 AS Integer
DIM f, i AS Integer

  SELECT CASE opera
  CASE 1
      re = v1 + v2
      z2 = 1
  CASE 2
      re = v1 ­ v2
      z2 = 1
  CASE 3
      re = v1 * v2
      z2 = 1
  CASE 4
      re = v1 / v2
      z2 = 1
  CASE 5
      re = (v1 * v2) / 100
      z2 = 1
  CASE 6
      re = v1 * v1
      z2 = 1
  CASE 7
      re = v1 * v1 * v1
      z2 = 1
  CASE 8
      re = 1 / v1
      z2 = 1
  CASE 9
      f = 1
    FOR i = 1 TO v1 
    f = f * i
  
    NEXT 
     re = f
     z2 = 1 
  CASE 10
     re = Rnd(v1)
      z2 = 1
           
  END SELECT 
  IF z2 = 1 THEN 
  RETURN re
  ELSE 
  RETURN y1
  ENDIF 
  END
  
PUBLIC SUB Button19_Click()
 BAN = 5
 IF TextBox1.Text <> 0 THEN 
 OP1 = TextBox1.Text
 ELSE 
 OP1 = 0
 ENDIF 
TextBox1.Clear
   

END

PUBLIC SUB Button20_Click()

   BAN = 6
 IF TextBox1.Text <> 0 THEN 
 OP1 = TextBox1.Text
 ELSE 
 OP1 = 0
 ENDIF 
TextBox1.Text = OP1

END

PUBLIC SUB Button21_Click()
'numero binario
DIM valor, x1, x2, i AS Integer
DIM cadena, cadena2 AS String
  valor = TextBox1.Text
  
  WHILE valor > 0
      x1 = valor MOD 2
      x2 = Int(valor / 2)
      cadena = cadena & Str(x1)
      valor = x2
  WEND     
  
  FOR i = Len(cadena) TO 1 STEP ­1
      cadena2 = cadena2 & (Mid(cadena, i, 1))
   NEXT    
  TextBox1.Text = cadena2 

END

PUBLIC SUB Button22_Click()

  'Calculo a octal de un número decimal
DIM valor, x1, x2, i AS Integer
DIM cadena, cadena2 AS String
' IF visor.Text <> 0 THEN  
   valor = TextBox1.Text
    WHILE valor > 0
      x1 = valor MOD 8
      x2 = Int(valor / 8)
      cadena = cadena & Str(x1)
      valor = x2
  WEND     
  
  FOR i = Len(cadena) TO 1 STEP ­1
      cadena2 = cadena2 & (Mid(cadena, i, 1))
   NEXT    
  TextBox1.Text = cadena2 

END

PUBLIC SUB Button23_Click()

 'Calculo a hexadecimal de un número decimal
DIM valor, x1, x2, i AS Integer
DIM cadena, cadena2 AS String
  valor = TextBox1.Text
  
  WHILE valor > 0
      x1 = valor MOD 16
      x2 = Int(valor / 16)
      IF x1 = 10 THEN
      cadena = cadena & "A"
      ELSE 
      IF x1 = 11 THEN
      cadena = cadena & "B"
      ELSE
      IF x1 = 12 THEN
      cadena = cadena & "C"
      ELSE
      IF x1 = 13 THEN
      cadena = cadena & "D"
      ELSE
      IF x1 = 14 THEN
      cadena = cadena & "E"
      ELSE
      IF x1 = 15 THEN
      cadena = cadena & "F"
      ELSE
      cadena = cadena & Str(x1)
      ENDIF
      ENDIF
      ENDIF
      ENDIF
      ENDIF
      ENDIF 
      valor = x2
  WEND     
  
  FOR i = Len(cadena) TO 1 STEP ­1
      cadena2 = cadena2 & (Mid(cadena, i, 1))
   NEXT    
  TextBox1.Text = cadena2  

END

PUBLIC SUB Button24_Click()

   BAN = 7
 IF TextBox1.Text <> 0 THEN 
 OP1 = TextBox1.Text
 ELSE 
 OP1 = 0
 ENDIF 
TextBox1.Text = OP1

END

PUBLIC SUB Button25_Click()

   BAN = 8
 IF TextBox1.Text <> 0 THEN 
 OP1 = TextBox1.Text
 ELSE 
 OP1 = 0
 ENDIF 
TextBox1.Text = OP1

END

PUBLIC SUB Button26_Click()

   BAN = 9
 IF TextBox1.Text <> 0 THEN 
 OP1 = TextBox1.Text
 ELSE 
 OP1 = 0
 ENDIF 
TextBox1.Text = OP1

END

PUBLIC SUB Button27_Click()
DIM v1, v2, f, i, re AS Integer    

    f = v2
    FOR i = 1 TO v2
    f = f * v1
  
    NEXT 
     re = f
    
END

PUBLIC SUB Button28_Click()

  DIM s AS Float
  s = Rad(TextBox1.Text)
  TextBox1.Text = Sin(s)
 
END

PUBLIC SUB Button29_Click()

 DIM c AS Float
  c = Rad(TextBox1.Text)
  TextBox1.Text = Cos(c)

END

PUBLIC SUB Button30_Click()
  DIM t AS Float
  t = Rad(TextBox1.Text)
  TextBox1.Text = Tan(t)
END

PUBLIC SUB Button31_Click()

  BAN = 10
 IF TextBox1.Text <> 0 THEN 
 OP1 = TextBox1.Text
 ELSE 
 OP1 = 0
 ENDIF 
TextBox1.Text = OP1

END




                                                  Cédula
PUBLIC SUB Main()
DIM b, c, d, e, f, g, h, i, x, z, xx AS Integer
DIM a AS String
PRINT "Ingrese el numero de cedula..."
INPUT a
FOR b = 1 TO 9 STEP 1
c = Str(Mid(a, b, 1))
d = b MOD 2
IF d = 0 THEN 
  i = i + c
  ELSE 
  h = c * 2
  IF h > 9 THEN 
  d = h MOD 10
  e = Int(h / 10)
  f = d + e
  ELSE 
  f = h
  ENDIF 
  g = g + f
  ENDIF 
  NEXT 
  x = g + i
  z = x MOD 10
  xx = 10 ­ z
  PRINT "El numero verificador es:...", xx
END

NOTA: Este ejercicio se ejecuta mediante la consola




                                             Juego 

PUBLIC SUB Button1_Click()

  DIM n1 AS Integer
  DIM n2 AS Integer
  DIM n3 AS Integer
  RANDOMIZE 
  n1 = Int(Rnd() * 10)
  n2 = Int(Rnd() * 10)
  n3 = Int(Rnd() * 10)
  TextBox1.Text = n1
  TextBox2.Text = n2
  TextBox3.Text = n3
  
  IF (n1 = n2) THEN 
    IF (n1 = n3) THEN 
    TextBox5.Text = TextBox4.Text * 2
    Message("Ganastes el Doble", "Puedes cobrar")
     TextBox1.Clear
     TextBox2.Clear
     TextBox3.Clear
     TextBox4.Clear
     TextBox5.Clear
  ELSE 
  IF (n1 = 7) THEN 
    IF (n2 = 7) THEN 
      IF (n3 = 7) THEN 
       TextBox5.Text = TextBox4.Text * 4
        Message("Ganastes el Premio Mayor", "Puedes cobrar")
        TextBox1.Clear
        TextBox2.Clear
        TextBox3.Clear
        TextBox4.Clear
        TextBox5.Clear
      ENDIF 
      ENDIF 
      ENDIF 
  ENDIF 
  ENDIF 
  
END

PUBLIC SUB Button2_Click()

  ME.Close

END




                                            Factura
PUBLIC i AS Integer
PUBLIC r AS Integer
PUBLIC m AS Integer

PUBLIC SUB _new()

END

PUBLIC SUB Form_Open()
TextBox5.SetFocus
GridView1.Columns.Count = 5
GridView1.Rows.Count = 10
GridView1.Columns[0].Width = 50
GridView1.Columns[1].Width = 200
GridView1.Columns[2].Width = 80
GridView1.Columns[3].Width = 50
GridView1.Columns[4].Width = 80
GridView1[0, 0].Text = "NUM"
GridView1[0, 1].Text = "DETALLE"
GridView1[0, 2].Text = "PRECIO.U"
GridView1[0, 3].Text = "CANT"
GridView1[0, 4].Text = "TOTAL"
r = 0
i = 0

END


PUBLIC SUB Button2_Click()

  TextBox1.Text = m
  TextBox2.Text = (m * 7) / 100
  TextBox3.Text = ((((TextBox1.Text) ­ (TextBox2.Text)) * 12) / 100)
  TextBox4.Text = (TextBox1.Text) ­ (TextBox2.Text) + (TextBox3.Text)
END

PUBLIC SUB TextBox5_KeyPress()

  IF Key.Code = 65293 THEN 
    IF TextBox5.Text = "" THEN 
      Message.Info("Ingrese Detalle")
      TextBox5.SetFocus
    ELSE 
     TextBox6.SetFocus
    ENDIF 
    ENDIF 

END


PUBLIC SUB TextBox7_KeyPress()

   IF Key.Code = 65293 THEN 
    IF TextBox7.Text = "" THEN 
    Message.Info("Ingrese Valor")
    TextBox7.SetFocus
    ELSE 
    i = i + 1
    r = r + 1
    TextBox8.Text = i
    GridView1[r, 0].Text = Val(TextBox8.Text)
    GridView1[r, 1].Text = (TextBox5.Text)
    GridView1[r, 2].Text = TextBox6.Text
    GridView1[r, 3].Text = TextBox7.Text
    
    TextBox9.Text = (TextBox6.Text) * (TextBox7.Text)
    GridView1[r, 4].Text = Val(TextBox9.Text)
    m = m + TextBox9.Text
    TextBox5.Text = ""
    TextBox6.Text = ""
    TextBox7.Text = ""
    TextBox5.SetFocus
    ENDIF 
  ENDIF 

END

PUBLIC SUB Button1_Click()

  TextBox1.Text = ""
  TextBox2.Text = ""
  TextBox3.Text = ""
  TextBox4.Text = ""
  TextBox5.Text = ""
  TextBox6.Text = ""
  TextBox7.Text = ""
  TextBox8.Text = ""
  TextBox9.Text = ""
  GridView1.Clear

END

PUBLIC SUB TextBox6_KeyPress()

  IF Key.Code = 65293 THEN
    IF TextBox6.Text = "" THEN 
       Message.Info("Ingrese Valor")
       TextBox6.SetFocus
    ELSE 
      TextBox7.SetFocus
                                                            ENDIF 
                                                           ENDIF  

                                                        END
Para realizar un gráfico
PUBLIC r AS Integer
PUBLIC posy AS Integer
PUBLIC posx AS Integer
PUBLIC al AS Integer
PUBLIC la AS Integer
PUBLIC SUB _new()

END

PUBLIC SUB Form_Open()
r = 20
al = 5
END

PUBLIC SUB Button1_Click()
  posy = area1.Height / 2
  posx = area1.Width / 2
  Draw.Begin(area1)
  Draw.FillColor = Color.RGB(100, 100, 50)
  Draw.FillStyle = Fill.Solid
  Draw.Circle(posx, posy, r)
  r = r + 20
  'Draw.Ellipse(200, 200, 100, 50)
  Draw.End

END

PUBLIC SUB Button3_Click()

  ME.Close

END

PUBLIC SUB Button2_Click()
  area1.Clear
  posy = area1.Height / 2
  posx = area1.Width / 2
  Draw.Begin(area1)
  Draw.FillColor = Color.RGB(100, 100, 50)
  Draw.FillStyle = Fill.Solid
  Draw.Circle(posx, posy, r)
  r = r ­ 20
  'Draw.Ellipse(200, 200, 100, 50)
  Draw.End
  

END

PUBLIC SUB Button4_Click()
  area1.Clear
  Draw.Begin(area1)
  posy = area1.Height / 2
  posx = area1.Width / 2
  Draw.FillColor = Color.RGB(100, 100, 50)
  Draw.FillStyle = Fill.Solid
  Draw.Rect(posx, posy, al, 20)
  'Draw.Ellipse(200, 200, 100, 50)
  Draw.End
   al = al + 10 
   al = al ­ (­10)
  
END




                                             Menú
PUBLIC SUB _new()

END
PUBLIC SUB Form_Open()

END

PUBLIC SUB Acerca_de_Click()

  Acercade.Show

END

PUBLIC SUB Cronometro_Click()

  Crono.Show
  

END

PUBLIC SUB Juego_Click()

  Jueg.Show

END

PUBLIC SUB Paint_Click()

  Pai.Show

END




                                 Cronómetro
PUBLIC SUB Timer1_Timer()

  seg.Text = Val(seg.Text) + 1
  IF seg.Text = 60 THEN
  min.Text = Val(min.Text) + 1
  seg.Text = 0
  ENDIF 
  IF min.Text = 60 THEN 
  hor.Text = Val(hor.Text) + 1
  min.Text = 0
  ENDIF 
END

PUBLIC SUB Button1_Click()

  IF Button1.Text = "Iniciar" THEN   
  Timer1.Enabled = TRUE
  Button1.Caption = "Parar"
  ELSE 
   Button1.Caption = "Iniciar"
   Timer1.Enabled = FALSE
   ENDIF 
END

PUBLIC SUB Button2_Click()

   seg.Text = "0"
   min.Text = "0"
   hor.Text = "0"
   Timer1.Enabled = TRUE
    Button1.Caption = "Parar"
   
   

END

PUBLIC SUB Button3_Click()

  ME.Close

END

PUBLIC SUB Form_Open()
  

END
Para realizar Operaciones Básicas

PUBLIC SUB _new()

END

PUBLIC SUB Form_Open()

END

PUBLIC SUB Label1_MouseDown()

  

END

PUBLIC SUB Button2_Click()

  TextBox1.Text = ""
  TextBox2.Text = ""
  TextBox3.Text = ""
  
END

PUBLIC SUB Button1_Click()

  TextBox3.Text = TextBox1.Text + TextBox2.Text

END

PUBLIC SUB Button6_Click()

  ME.Close

END

PUBLIC SUB Button3_Click()

  TextBox3.Text = TextBox1.Text ­ TextBox2.Text

END
PUBLIC SUB Button4_Click()

  TextBox3.Text = TextBox1.Text * TextBox2.Text

END

PUBLIC SUB Button5_Click()

  TextBox3.Text = TextBox1.Text / TextBox2.Text

END




                              Transformar de números a letras
' Attribute VB_Name = "Module1" 
' Option Explicit 
 
PUBLIC FUNCTION EnLetras(numero AS String) AS String 
    DIM b, paso AS Integer 
    DIM expresion, entero, deci, flag AS String        
    flag = "N" 
    FOR paso = 1 TO Len(numero) 
        IF Mid(numero, paso, 1) = "." THEN 
            flag = "S" 
        ELSE 
            IF flag = "N" THEN 
                entero = entero & Mid(numero, paso, 1) 'Extae la parte entera del numero 
            ELSE 
                deci = deci & Mid(numero, paso, 1) 'Extrae la parte decimal del numero 
            END IF 
        END IF 
    NEXT 
'     paso 
     
    IF Len(deci) = 1 THEN 
        deci = deci & "0" 
    END IF 
    flag = "N" 
    IF Val(numero) >= ­999999999 AND Val(numero) <= 999999999 THEN 'si el numero esta 
dentro de 0 a 999.999.999 
        
        FOR paso = Len(entero) TO 1 STEP ­1 
            b = Len(entero) ­ (paso ­ 1) 
            
            SELECT CASE paso 
            CASE 3, 6, 9 
                SELECT CASE Mid(entero, b, 1) 
                    CASE "1" 
                        IF Mid(entero, b + 1, 1) = "0" AND Mid(entero, b + 2, 1) = "0" THEN 
                            expresion = expresion & "cien " 
                        ELSE 
                            expresion = expresion & "ciento " 
                        END IF 
                    CASE "2" 
                        expresion = expresion & "doscientos " 
                    CASE "3" 
                        expresion = expresion & "trescientos " 
                    CASE "4" 
                        expresion = expresion & "cuatrocientos " 
                    CASE "5" 
                        expresion = expresion & "quinientos " 
                    CASE "6" 
                        expresion = expresion & "seiscientos " 
                    CASE "7" 
                        expresion = expresion & "setecientos " 
                    CASE "8" 
                        expresion = expresion & "ochocientos " 
                    CASE "9" 
                        expresion = expresion & "novecientos " 
                END SELECT 
                 
            CASE 2, 5, 8 
                SELECT CASE Mid(entero, b, 1) 
                    CASE "1" 
                        IF Mid(entero, b + 1, 1) = "0" THEN 
                            flag = "S" 
                            expresion = expresion & "diez " 
                        END IF 
                        IF Mid(entero, b + 1, 1) = "1" THEN 
                            flag = "S" 
                            expresion = expresion & "once " 
                        END IF 
                        IF Mid(entero, b + 1, 1) = "2" THEN 
                            flag = "S" 
                            expresion = expresion & "doce " 
                        END IF 
                        IF Mid(entero, b + 1, 1) = "3" THEN 
                            flag = "S" 
                            expresion = expresion & "trece " 
                        END IF 
                        IF Mid(entero, b + 1, 1) = "4" THEN 
                            flag = "S" 
                            expresion = expresion & "catorce " 
                        END IF 
                        IF Mid(entero, b + 1, 1) = "5" THEN 
                            flag = "S" 
                            expresion = expresion & "quince " 
                        END IF 
                        IF Mid(entero, b + 1, 1) > "5" THEN 
                            flag = "N" 
                            expresion = expresion & "dieci" 
                        END IF 
                 
                    CASE "2" 
                        IF Mid(entero, b + 1, 1) = "0" THEN 
                            expresion = expresion & "veinte " 
                            flag = "S" 
                        ELSE 
                            expresion = expresion & "veinti" 
                            flag = "N" 
                        END IF 
                     
                    CASE "3" 
                        IF Mid(entero, b + 1, 1) = "0" THEN 
                            expresion = expresion & "treinta " 
                            flag = "S" 
                        ELSE 
                            expresion = expresion & "treinta y " 
                            flag = "N" 
                        END IF 
                 
                    CASE "4" 
                        IF Mid(entero, b + 1, 1) = "0" THEN 
                            expresion = expresion & "cuarenta " 
                            flag = "S" 
                        ELSE 
                            expresion = expresion & "cuarenta y " 
                            flag = "N" 
                        END IF 
                 
                    CASE "5" 
                        IF Mid(entero, b + 1, 1) = "0" THEN 
                            expresion = expresion & "cincuenta " 
                            flag = "S" 
                        ELSE 
                            expresion = expresion & "cincuenta y " 
                            flag = "N" 
                        END IF 
                 
                    CASE "6" 
                        IF Mid(entero, b + 1, 1) = "0" THEN 
                            expresion = expresion & "sesenta " 
                            flag = "S" 
                        ELSE 
                            expresion = expresion & "sesenta y " 
                            flag = "N" 
                        END IF 
                 
                    CASE "7" 
                        IF Mid(entero, b + 1, 1) = "0" THEN 
                            expresion = expresion & "setenta " 
                            flag = "S" 
                        ELSE 
                            expresion = expresion & "setenta y " 
                            flag = "N" 
                        END IF 
                 
                    CASE "8" 
                        IF Mid(entero, b + 1, 1) = "0" THEN 
                            expresion = expresion & "ochenta " 
                            flag = "S" 
                        ELSE 
                            expresion = expresion & "ochenta y " 
                            flag = "N" 
                        END IF 
                 
                    CASE "9" 
                        IF Mid(entero, b + 1, 1) = "0" THEN 
                            expresion = expresion & "noventa " 
                            flag = "S" 
                        ELSE 
                            expresion = expresion & "noventa y " 
                            flag = "N" 
                        END IF 
                END SELECT 
                 
            CASE 1, 4, 7 
                SELECT CASE Mid(entero, b, 1) 
                    CASE "1" 
                        IF flag = "N" THEN 
                            IF paso = 1 THEN 
                                expresion = expresion & "uno " 
                            ELSE 
                                expresion = expresion & "un " 
                            END IF 
                        END IF 
                    CASE "2" 
                        IF flag = "N" THEN 
                            expresion = expresion & "dos " 
                        END IF 
                    CASE "3" 
                        IF flag = "N" THEN 
                            expresion = expresion & "tres " 
                        END IF 
                    CASE "4" 
                        IF flag = "N" THEN 
                            expresion = expresion & "cuatro " 
                        END IF 
                    CASE "5" 
                        IF flag = "N" THEN 
                            expresion = expresion & "cinco " 
                            
                        END IF 
                    CASE "6" 
                        IF flag = "N" THEN 
                            expresion = expresion & "seis " 
                        END IF 
                    CASE "7" 
                        IF flag = "N" THEN 
                            expresion = expresion & "siete " 
                        END IF 
                    CASE "8" 
                        IF flag = "N" THEN 
                            expresion = expresion & "ocho " 
                        END IF 
                    CASE "9" 
                        IF flag = "N" THEN 
                            expresion = expresion & "nueve " 
                        END IF 
                END SELECT 
            END SELECT 
            IF paso = 4 THEN 
                IF Mid(entero, 6, 1) <> "0" OR Mid(entero, 5, 1) <> "0" OR Mid(entero, 4, 1) <> "0" OR 
(Mid(entero, 6, 1) = "0" AND Mid(entero, 5, 1) = "0" AND Mid(entero, 4, 1) = "0" AND 
Len(entero) <= 6) THEN 
                    expresion = expresion & "mil " 
                END IF 
            END IF 
            IF paso = 7 THEN 
                IF Len(entero) = 7 AND Mid(entero, 1, 1) = "1" THEN 
                    expresion = expresion & "millón " 
                ELSE 
                    expresion = expresion & "millones " 
                END IF 
            END IF 
        NEXT 
'         paso 
         
        IF deci <> "" THEN 
            IF Mid(entero, 1, 1) = "­" THEN 'si el numero es negativo 
                expresion = "menos " & expresion & "con " & deci & "/100" 
            ELSE 
                expresion = expresion & "con " & deci & "/100" 
            END IF 
        ELSE 
            IF Mid(entero, 1, 1) = "­" THEN 'si el numero es negativo 
                expresion = "menos " & expresion 
            ELSE 
                expresion = expresion 
            END IF 
        END IF 
    ELSE 'si el numero a convertir esta fuera del rango superior e inferior 
        expresion = "" 
    END IF 
    TextBox2.Text = expresion
END FUNCTION 

PUBLIC SUB Button1_Click()
EnLetras(TextBox1.Text)
' TextBox2.Text = "3"
END

PUBLIC SUB Button3_Click()

  TextBox1.Text = ""
  TextBox2.Text = ""

END

PUBLIC SUB Button2_Click()

  ME.Close

END

Ejercicios