N3v3r G1v3 uP

Using fuction

10/11/2009 22:03

design program make animation with string function. how to print odd and prime number using math function. and here there include how to make star prediction using date function.

how to make this project. follow this steps

1. make new project and design form like below

NB. Make Setting on timer tool like below

Form/Control Properties Setting
Timer2

Name

Enabled

interval

Timer2

False

150

Timer3

Name

Enabled

Interval

Timer3

False

150

Timer4

Name

Enabled

Interval

Timer4

false

150

 

 

 

 

 

 

 

 

 

 

 

 

2. make declaration variable on general

Dim ket1 As String, ket3 As String
Dim n As Integer, k As Integer

3. double click on the form to make procedure form load

Private Sub Form_Load()
n = 1
k = 1
ket1 = ""
End Sub

4. do double click on the object text1 and type listing like below

Private Sub Text1_KeyPress(KeyAscii As Integer)
   If KeyAscii = 13 Then
       ket3 = Text1.Text
      Timer2.Enabled = True
      Timer3.Enabled = True
      Timer4.Enabled = True
  End If
End Sub

5. double click on the timer2 and make listing like below

Private Sub Timer2_Timer()
   ket1 = ket1 & Mid(Text1.Text, n, 1)
   Label2.Caption = ket1
   If n = Len(Text1.Text) Then
   ket1 = ""
   n = 1
   Else
     n = n + 1
   End If
End Sub

5. double click on the timer3 and make listing like below

Private Sub Timer3_Timer()
   Label3.Caption = Left(Text1.Text, k)
   If k = Len(Text1.Text) Then
   k = 1
   Else
     k = k + 1
   End If
End Sub

6. double click on the timer4 and make listing like below

Private Sub Timer4_Timer()
ket3 = Right(ket3, Len(ket3) - 1) & Left(ket3, 1)
Label4.Caption = ket3
End Sub

7. double click on the text2 and make listing like below

Private Sub Text2_KeyPress(KeyAscii As Integer)
Dim bil As Integer, jml As Integer
Dim p1 As Integer, p2 As Integer
Dim hasil As String, hasil1 As String
hasil = ""
hasil1 = ""
jml = 0
If KeyAscii = 13 Then
  For bil = 1 To Text2.Text
  If (bil Mod 2) = 1 Then
     hasil = hasil & "" & bil
  End If
 Next
 Label8.Caption = hasil
   For p1 = 2 To Text2.Text
     For p2 = 1 To p1
       If (p1 Mod p2) = 0 Then
        jml = jml + 1
    End If
    Next
    If jml <= 2 Then
      hasil1 = hasil1 & "" & p1
    End If
    jml = 0
    Label9.Caption = hasil1
    Next
  End If
End Sub

8. run the program and you will see the result " type The words you want" on the text1 (enter) and type the number you want on the text2 (enter)

9. add common botton and type on the caption " Ramalan Bintang" double click on its common botton ang type listing like below

Private Sub Command1_Click()
frm_bintang.Show
End Sub

10. add commandBotton 1 again and type on the caption "selesai" and give listing like below

Private Sub Command2_Click()
End
End Sub

11. Add new Fom adn design form like below

13. double click on the text1 and make listing like below

Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim tgl, new_tgl
Dim ket As String
  If KeyAscii = 13 Then
  tgl = DateValue(Text1)
  new_tgl = Month(tgl) & "/" & Day(tgl) & "/" & "00"
  Select Case new_tgl
  Case #12/21/2000# To #1/19/2000#
     ket = "Capricornus"
  Case #1/20/2000# To #2/18/2000#
     ket = "Aquarius"
  Case #2/19/2000# To #3/20/2000#
     ket = "Pisces"
  Case #3/21/2000# To #4/20/2000#
     ket = "Aries"
  Case #4/21/2000# To #5/20/2000#
     ket = "Taurus"
  Case #5/21/2000# To #6/20/2000#
     ket = "Gemini"
  Case #6/21/2000# To #7/20/2000#
     ket = "Cancer"
  Case #7/21/2000# To #8/20/2000#
     ket = "Leo"
  Case #8/21/2000# To #9/20/2000#
     ket = "Virgo"
  Case #9/21/2000# To #10/20/2000#
     ket = "Libra"
  Case #10/21/2000# To #11/20/2000#
     ket = "Scorpio"
  Case #11/21/2000# To #12/20/2000#
     ket = "Sagitarius"
End Select
Label4.Caption = ket
End If
End Sub

14. double click on the commandbotton "kembali" and type listing like below

Private Sub Command1_Click()
Unload Me
End Sub

15. finally the result is like below

Subscribe
Back

Topic: Using fuction

No comments found.

Search site

ranto© 2010 All rights reserved.