Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Monday, July 18, 2011

VB-48 : Print Fibonacci Series

Design an application to print the Fibonacci Series.+

A)    Program Design : 


(B) Property(Controls Used) :
  •      2 Labels
  •      2 Text Boxes (Property of second text box is : Locked-True,Multiline-True,Scrollbars-Both,Text-(Blank)
  •       One Command Button with Caption Generate
(C) Attaching Code to the Object :

                        

Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer
a = 0
b = 1
Text2 = ""
Do
Text2 = Text2 & a
c = a + b
a = b
b = c
If (a > valtext1.Text) Then
Text2 = Text2 & "."
Exit Do
Else
Text2 = Text2 & ","
End If
Loop
End Sub
Private Sub Text1_Change()
If Val(Text1.Text) > 100 Or Val(Text1) < 0 Then
MsgBox "Limit should between 0 and 100 only"
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
SendKeys (Char(8))
End If
End Sub






====================================================================
=========================================================

No comments: