Crear Una Pirámide De N Filas By Jhonjhon_123

Iniciado por Jhonjhon_123, Febrero 28, 2010, 04:15:55 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Febrero 28, 2010, 04:15:55 PM Ultima modificación: Julio 08, 2011, 09:23:14 AM por ANTRAX
Bueno, este es un ejercicio de un libro, y se los quise pasar.

El ejercicio consiste en crear un code que haga una pirámide de N filas.



Codigo De Fuente:

Necesitan 2 TextBox
     1. TXT_Pir > Para Ver La pirámide > MultiLine = True > Locked = True
     2. TXT_Filas > No De Filas
1 CommandButton > CMD_Run > Crear Pirámide

Código: vb

Option Explicit

Private Sub CMD_Run_Click()
Dim D As Long
Dim N As Long

TXT_Pir.Text = ""

For D = Val(TXT_Filas.Text) To 1 Step -1
    N = D + (D - 1)
    Call Escribir(N, "*", TXT_Pir)
Next

End Sub


Function Escribir(Veces As Long, Char As String, TXT As TextBox)
Dim D As Long
For D = 1 To Veces
    TXT = TXT & Char
Next
TXT = TXT & vbCrLf
End Function

Private Sub Form_Load()
With TXT_Pir
    .Font = "OCR A Std"
    .FontBold = True
    .FontSize = 12
End With
End Sub

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login