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 :
(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.
- ====================================================================