Hi guys! in this program the user will type any text and the user will input on the next textbox the letter that is going to be searched. After that the user will click the button name "Search" then the output will show. Below is the source code of this program. Hope this will help you. Enjoy and Happy coding! :)
Private Sub Command1_Click()
Dim x, y As Integer
For x = 1 To Len(Text1.Text)
If Mid(Text1.Text, x, 1) = Text2.Text Then
y = y + 1
End If
Next
Label1.Caption = y
Label2.Caption = Text2.Text & " 's"
End Sub
Saturday, February 12, 2011
Multiplication Table
Hi guys! this is simple program on how to generate a multiplication table. below is the source code on how to generate it. Hope this will help you. Enjoy and Happy coding! :)
Private Sub Command1_Click()
Dim a As Integer
Label1.Caption = Empty
For row = 1 To Text1.Text
For col = 1 To Text1.Text
a = row * col
Label1.Caption = Label1.Caption & a & " "
Next
Label1.Caption = Label1.Caption & vbCrLf
Next
End Sub
Private Sub Command1_Click()
Dim a As Integer
Label1.Caption = Empty
For row = 1 To Text1.Text
For col = 1 To Text1.Text
a = row * col
Label1.Caption = Label1.Caption & a & " "
Next
Label1.Caption = Label1.Caption & vbCrLf
Next
End Sub
Monday, February 7, 2011
String Functions w/ size
Hi guys! this is the sample code of the basic string function shown above with size of the strings you want to display.Hope this will help you.
Happy coding! :)
Private Sub Command1_Click()
Label1.Caption = Left(Text1.Text, Text2.Text)
Label2.Caption = Right(Text1.Text, Text2.Text)
Label3.Caption = Mid(Text1.Text, Len(Text1.Text) / 2, Text2.Text)
Label13.Caption = UCase(Text1.Text)
Label12.Caption = LCase(Text1.Text)
End Sub
Happy coding! :)
Private Sub Command1_Click()
Label1.Caption = Left(Text1.Text, Text2.Text)
Label2.Caption = Right(Text1.Text, Text2.Text)
Label3.Caption = Mid(Text1.Text, Len(Text1.Text) / 2, Text2.Text)
Label13.Caption = UCase(Text1.Text)
Label12.Caption = LCase(Text1.Text)
End Sub
Simple text encryption
Hi guys! this is the sample code of the encrypted text shown above. Hope this will help you. Enjoy!
Happy coding! :)
Private Sub Command1_Click()
For x = 1 To Len(Text1.Text)
Label1.Caption = Label1.Caption & Chr(Asc(Mid(Text1.Text, x, 1)) + 5)
Next
End Sub
Happy coding! :)
Private Sub Command1_Click()
For x = 1 To Len(Text1.Text)
Label1.Caption = Label1.Caption & Chr(Asc(Mid(Text1.Text, x, 1)) + 5)
Next
End Sub
Sunday, February 6, 2011
Making right angle triangle using asterisk w/ size
Hi guys! this is my right triangle with size 8. Here is the sample code of the image above. Hope this will help you.
Enjoy! and Happy coding!! :)
Private Sub Command1_Click()
For x = 1 To txtsize
For y = 1 To x
Label3.Caption = Label3.Caption & "*"
Next
Label3.Caption = Label3.Caption & vbCrLf
Next
End Sub
Enjoy! and Happy coding!! :)
Private Sub Command1_Click()
For x = 1 To txtsize
For y = 1 To x
Label3.Caption = Label3.Caption & "*"
Next
Label3.Caption = Label3.Caption & vbCrLf
Next
End Sub
Moving your form upside down
Hi guys! this is the sample code of moving your form upside down. Hope this will help you. Enjoy!
Happy coding! :)
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer2.Enabled = True
End Sub
Private Sub Command3_Click()
Timer3.Enabled = True
End Sub
Private Sub Command4_Click()
Timer4.Enabled = True
End Sub
Private Sub Command5_Click()
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
End Sub
Private Sub Form_Load()
Timer1.Interval = 10
Timer2.Interval = 10
Timer3.Interval = 10
Timer4.Interval = 10
End Sub
Private Sub Timer1_Timer()
Me.Top = Me.Top - 10
End Sub
Private Sub Timer2_Timer()
Me.Top = Me.Top + 10
End Sub
Private Sub Timer3_Timer()
Me.Left = Me.Left + 10
End Sub
Private Sub Timer4_Timer()
Me.Left = Me.Left - 10
End Sub
Happy coding! :)
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer2.Enabled = True
End Sub
Private Sub Command3_Click()
Timer3.Enabled = True
End Sub
Private Sub Command4_Click()
Timer4.Enabled = True
End Sub
Private Sub Command5_Click()
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
End Sub
Private Sub Form_Load()
Timer1.Interval = 10
Timer2.Interval = 10
Timer3.Interval = 10
Timer4.Interval = 10
End Sub
Private Sub Timer1_Timer()
Me.Top = Me.Top - 10
End Sub
Private Sub Timer2_Timer()
Me.Top = Me.Top + 10
End Sub
Private Sub Timer3_Timer()
Me.Left = Me.Left + 10
End Sub
Private Sub Timer4_Timer()
Me.Left = Me.Left - 10
End Sub
Stopwatch
Hi guys! this is the sample code of the stopwatch that I made. Hope this will help you. Enjoy and Happy Coding! :)
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Command3_Click()
sec.Caption = "00"
min.Caption = "00"
hour.Caption = "00"
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim h, m, s As Integer
sec.Caption = Val(sec.Caption) + 1
If Val(sec.Caption) < 10 Then
sec.Caption = "0" & sec.Caption
End If
If Val(sec.Caption) = 60 Then
min.Caption = Val(min.Caption) + 1
sec.Caption = "00"
If Val(min.Caption) < 10 Then
min.Caption = "0" & min.Caption
End If
End If
If Val(min.Caption) = 60 Then
hour.Caption = Val(hour.Caption) + 1
min.Caption = "00"
If Val(hour.Caption) < 10 Then
hour.Caption = "0" & hour.Caption
End If
End If
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Command3_Click()
sec.Caption = "00"
min.Caption = "00"
hour.Caption = "00"
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim h, m, s As Integer
sec.Caption = Val(sec.Caption) + 1
If Val(sec.Caption) < 10 Then
sec.Caption = "0" & sec.Caption
End If
If Val(sec.Caption) = 60 Then
min.Caption = Val(min.Caption) + 1
sec.Caption = "00"
If Val(min.Caption) < 10 Then
min.Caption = "0" & min.Caption
End If
End If
If Val(min.Caption) = 60 Then
hour.Caption = Val(hour.Caption) + 1
min.Caption = "00"
If Val(hour.Caption) < 10 Then
hour.Caption = "0" & hour.Caption
End If
End If
End Sub
Moving texts using timer component
Hi guys! this is the sample code of the moving text using the timer component. hope this will help..
Happy coding! :)
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Label1.Left = 0
Label1.Top = 0
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
If Label1.Top = 0 Then
Label1.Left = Label1.Left + 10
End If
If Label1.Left = 5000 Then
Label1.Top = Label1.Top + 10
End If
If Label1.Top = 5000 Then
Label1.Left = Label1.Left - 10
End If
If Label1.Left = 0 Then
Label1.Top = Label1.Top - 10
End If
End Sub
Happy coding! :)
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Label1.Left = 0
Label1.Top = 0
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
If Label1.Top = 0 Then
Label1.Left = Label1.Left + 10
End If
If Label1.Left = 5000 Then
Label1.Top = Label1.Top + 10
End If
If Label1.Top = 5000 Then
Label1.Left = Label1.Left - 10
End If
If Label1.Left = 0 Then
Label1.Top = Label1.Top - 10
End If
End Sub
Friday, February 4, 2011
How to generate 7 random letters
Hi everyone! this is a sample code on how to generate 7 random letters in one click.. hope this will help you!
happy coding!! :)
Private Sub Command1_Click()
Dim x, z As String
Label1.Caption = Empty
For y = 1 To 7
Randomize
x = Round(97 + 25 * Rnd())
z = UCase(Chr(x))
Label1.Caption = Label1.Caption + z
Next
End Sub
happy coding!! :)
Private Sub Command1_Click()
Dim x, z As String
Label1.Caption = Empty
For y = 1 To 7
Randomize
x = Round(97 + 25 * Rnd())
z = UCase(Chr(x))
Label1.Caption = Label1.Caption + z
Next
End Sub
Subscribe to:
Posts (Atom)