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, August 1, 2011

VB-79 : Find the value of y=x(sinx+cosx)

Write a program in VB which will produce a table of values of the equation  y=x(sinx+cosx) where, user can given values between 0 < = x <= 60 (0 less than or equal to x less than or equal to 60).


(A)Program Design : 



(B) Property(Controls Used) :

  • 3 Labels with proper Captions as shown above
  • 2 TextBoxes (One for user input and other for output)
  • 2 command buttons Calculate Y & Cancel 
(C) Attaching Code to the Object :

Private Sub Command1_Click()
Dim x
Dim y
x = Val(Text1.Text)
If x <= 0 And x >= 60 Then
MsgBox "Enter proper value of x between 0 and 60"
Text1.Text = ""
Text1.SetFocus
Else
y = x * (Math.Sin(x) + Math.Cos(x))
Text2.Text = y
End If
End Sub
Private Sub Command2_Click()
Text2.Text = ""
Text1.Text = ""
Text1.SetFocus
End Sub

 

(E) Errors :

If found any errors while running your VB program, please click this link   Possible Errors while running VB Programs to get a solution.


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

    VB-78 : Encryption and Decryption


    Write a program in VB for Encryption and Decryption using the simple logic given below :
    A <=> 1
    B <=> 2
    ............
    ...........
    Z <=> 26
    In a Text Box, user types a message in English. On pressing Encrypt button, program will convert that message into integer form and on pressing Decrypt button , it will convert the integer values into the character (English) pattern.


    (A)Program Design :



    (B) Property(Controls Used) :
    • 2 Labels
    • 2 Text Boxes (Text1,Text2) for entering the input string and to show the result.
    • One command button "Encrypt"
    (C) Attaching Code to the Object :

    Dim icounter As Integer
    Dim ch As String
    Private Sub Command1_Click()
    Text2 = ""
    For icounter = 1 To Len(Text1)
    ch = Mid(Text1, icounter, 1)
    ch = UCase(ch)
    j = Asc(ch) - 64
    Text2 = Text2 & j
    Next
    End Sub
    (D) Output :




    (E) Errors :

    If found any errors while running your VB program, please click this link   Possible Errors while running VB Programs to get a solution.



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

      VB-77 : Temperature Conversion

      Write a program in VB to convert the Celsius to Fahrenheit and Fahrenheit to Celsius.
      Provide 2 buttons and 2 TextBoxes.One Button converts Fahrenheit to Celsius and the other convert Celsius to Fahrenheit. Use the formula :
      Celsius=(5/9)*(Fahrenheit-32)
      Refer Conversion of Temperature also.

      (A)Program Design : 




      (B) Property(Controls Used) :
      • One Label " Enter Temperature"
      • 2 TextBoxes (One for getting input from the user-Text1 , and the other is for displaying result-Text2)
      • 2 Command Buttons - Celsius & Fahrenheit
      (C) Attaching Code to the Object :

      Dim c, f As Double
      Private Sub Command1_Click()
      f = Val(Text1)
      c = Round((5 / 9) * (f - 32), 2)
      Text2 = f & " Degree Fahrenheit=" & c & " Degree Celsius"
      End Sub
      Private Sub Command2_Click()
      c = Val(Text1)
      f = Round((c * 1.8) + 32, 2)
      Text2 = c & " Degree Celsius=" & f & " Degree Fahrenheit"
      End Sub





      (D) Output :




      (E) Errors :

      If found any errors while running your VB program, please click this link   Possible Errors while running VB Programs to get a solution.



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