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

Wednesday, July 13, 2011

VB-40 : Generating Initial from the given name

Collect the First Name,Middle Name and Last Name from the user on three separate text boxes and display the user's short name.

A)    Program Design : 

(B) Property(Controls Used) :
  •      4 Labels and their CAPTIONS are Enter First Name,Enter Middle Name,Enter Last Name and Initial is.
  •       One Command Button and its CAPTION is Generate Initial
  •       3 Text Boxes

(C) Attaching Code to the Object :
                 

Private Sub Command1_Click()
Dim str As String
str = ""
str = Mid(Trim(Text1.Text), 1, 1) + "."
str = str + Mid(Trim(Text2.Text), 1, 1) + "."
str = str + Mid(Trim(Text3.Text), 1, 1) + "."
Label4.Caption = "Initial is - " + str
End Sub

D)    Output : 



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

    VB-39 : Find the integer is odd or even.

    Write an event procedure to collect an integer from the user and find out whether the given integer is an odd or an even one. Design a splash screen for this application. Use appropriate controls on the form.


    Compare this program with the JAVA program. 

    Odd or Even checking in JAVA


    A)   Program Design : 




    (B) Property(Controls Used) :
    •      2 Labels - Captions are Enter an integer number and Result : 
    •      One Command Button - Caption is Check
    •       One Text Box
    (C) Attaching Code to the Object :
    (Splash Screen Code is not given)
    Private Sub Command1_Click()
    Dim num As Integer
    num = Val(Text1.Text)
    If num Mod 2 = 0 Then
    Label2.Caption = "Result : The number is even"
    Else
    Label2.Caption = "Result : The number is odd"
    End If
    End Sub


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

      VB-38 : Create a form to enter some text and have the result

      Create a form where the user can enters some text into the text box control and have the result output into a label in a different font with the colour change in the background of the form.

      Refer Simple Programs(2) and Print your name on the form also.
      A)     Program Design : 


      (B) Property(Controls Used) :
      •      Label1  : Caption - Name
      •      Label2  :  No Caption , Font Name-Garmond,Style-Bold Italic,Font Colour-&H000040C0&
      •      TextBox - Text Property shold kept blank

      (C) Attaching Code to the Object :
                   
      Private Sub Text1_Change()
      Label2.Caption = "Name:" + Text1.Text
      End Sub


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

        VB-37 : Displaying triangle using given measurements

        Write an event procedure to display the type of triangle,given the measurements of its 3 sides by the user.

        Note : 

        • Equilateral Triangle    :   3 sides are equal
        • Isosceles Triangle      :   2 sides are equal
        • Scalene Triangle        :   All sides are unequal
        Design a very interactive user interface.

        A)    Program Design : 

        ASSUMPTION :
        •       Mouse click on picture box select a point for Triangle
        •        Analyze button is enabled only after completion of Triangle
        •        Line Size is calculated in centimeter for 1 decimal point

        (B) Property(Controls Used) :
        •        5 Labels and change their CAPTIONS as : Canvas : Click to select point for drawing a triangleTriangle,Line Size 1-2,Line Size 2-3,Line Size 3-1.
        •       3 more Labels with no CAPTIONS and name is lbl.
        •       Picture Box - Picture-none,Autodraw-True,ScaleMode-7 cm.
        •       3 Command Buttons - and change their CAPTIONS as : Reset,Analyze and Exit.
        (C) Attaching Code to the Object :


        Dim PX(3) As Single
        Dim PY(3) As Single
        Dim size(3) As Single
        Dim i As Integer
        Private Sub Command3_Click()
        Unload Me
        End Sub
        Private Sub Command1_Click()
        Picture1.Cls
        Command2.Enabled = False
        i = 0
        For j = 0 To 2
        lbl(j).Caption = ""
        Next
        End Sub
        Private Sub Command2_Click()
        For j = 0 To 2
        NextJ = (j + 1) Mod 3
        xdist = PX(NextJ) - PX(j)
        ydist = PY(NextJ) - PY(j)
        size(j) = Sqr((xdist * xdist) + (ydist * ydist))
        size(j) = Round(size(j), 1)
        lbl(j).Caption = size(j)
        Next j
        If size(0) = size(1) Then
        If size(1) = size(2) Then
        Label1.Caption = "EQUILATERAL TRIANGLE"
        Else
        Label1.Caption = "ISOSCELES TRIANGLE"
        End If
        ElseIf (0) = size(2) Then
        Label1.Caption = "ISOSCELES TRIANGLE"
        ElseIf size(1) = size(2) Then
        Label1.Caption = "ISOSCELES TRIANGLE"
        Else
        Label1.Caption = "SCALENE TRIANGLE"
        End If
        Private Sub Form_Load()
        Picture1.DrawWidth = 2
        i = 0
        End Sub
        Private Sub picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If i < 3 Then
        PX(i) = X
        PY(i) = Y
        picture1.Circle((PX(i),PY(i)),0.1,vbRed
        If i > 0 Then
        picture1.line((PX(i-1)&(PY(i-1))-(PX(i)&PY(i))
        End If
        If i = 2 Then
        picture1.Line((PX(2),PY(2))-(PX(0),PY(0))
        End If
        i = i + 1
        End If
        If i = 3 Then
        Command1.Enabled = True
        End If
        End Sub
            • ====================================================================
              Back to Home   &  VB
          ===========================================================