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 11, 2011

VB-36 : Slide Show

Create a form with a picture-box. Find 3 interesting pictures and use a time control to cycle these 3 pictures every one second.Place an exit button to close the application..

A)    Program Design : 

(B) Property(Controls Used) :
  1.       Command Button - CAPTION- Exit
  2.       Timer                         - INTERVAL - 1000
  3.       Picture Box             -  PICTURE - none

(C) Attaching Code to the Object :

Dim Pictures() As String
Dim i As Integer
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
Pictures(0) = "c:\My Documents\My Pictures\Sample Pictures\Blue hills.JPEG"
Pictures(1) = "c:\My Documents\My Pictures\Sample Pictures\Sunset.JPEG"
Pictures(2) = "c:\My Documents\My Pictures\Sample Pictures\Water lilies.JPEG"
i = 0
End Sub
Private Sub Timer1_Timer()
Index = i Mod 3
Picture1.Picture = LoadPicture(Pictures(Index))
i = i + 1
End Sub



Error in Output as "Subscript out of range"

      • ====================================================================
        Back to Home   &  VB
    ===========================================================

    VB-35 : Find rightmost occurrence of n-length string

    Write an event procedure to find and display the rightmost occurrence of an input character of a n-length string.

    Refer  Total words,Characters,sentence,length of ... also.
    A)    Program Design : 




    (B) Property(Controls Used) :
    1. Two Labels and change their CAPTIONS as : Enter a Paragraph and Search rightmost character.
    2. Two Text Boxes 
    3. One Command Button and change its CAPTION as : Find character.

    (C) Attaching Code to the Object :

    Private Sub Command1Find_Click()
    Dim str As String
    str = Text1.Text
    i = 0

    For i = Len(str) To 1 Step -1
    t = Mid(str, i, 1)

    If t = txtchar Then

    Text1.SelLength = i - 1
    Text2.SelStart = 1
    GoTo cmd_end
    End If
    Next i

    cmd_end:

    End Sub


    (Some error in output)


        • ====================================================================
          Back to Home   &  VB
      ===========================================================

      VB-34 : Count Blanks,Tabs,etc in a String

      Write a VB application to count the number of Blanks,Tabs,and Newline characters in a given string.Use appropriate controls and provide a user friendly interface.


      Click to see a simple program of this type The number of digits in the entered Number...


      Refer Total words,Characters,sentence,length of ... also

      A)    Program Design : 

      (B) Property(Controls Used) :
      1.       Four Labels and change their CAPTIONS as : Enter a Paragraph,White Spaces,Horizontal Tabs and New Lines.
      2.       One Command Button and change its CAPTION as Count Spaces.
      3.      Four Text Boxes and delete their Text Properties.
              (C) Attaching Code to the Object :
          
      Private Sub Command1_Click()
      i = 1
      linecnt = 1
      tabcnt = 1
      spacecnt = 1
      Dim str As String
      str = Text1.Text

      For i = 1 To Len(str)
      If Mid(str, i, 1) = vbLf Then
         linecnt = linecnt + 1
      ElseIf Mid(str, i, 1) = " " Then
         spacecnt = spacecnt + 1
      ElseIf Mid(str, i, 1) = vbTab Then
         tabcnt = tabcnt + 1
      End If
      Next

      Text2.Text = spacecnt
      Text3.Text = tabcnt
      Text4.Text = linecnt

      End Sub

          • ====================================================================
            Back to Home   &  VB
        ===========================================================