Lab (VLP & Internet Technologies) : Assignment Work - 506
Lab (VLP & Internet Technologies) : Assignment Work - 506
Lab (VLP & Internet Technologies) : Assignment Work - 506
SUBMITTED TO | MISS HARLEEN KAUR BY | SHARIQ PARWEZ | BCA 5TH SEM | ENRL 2011-301-047
LIST OF PROGRAMS
I. Design a Demo Application Form. II. Design a Form to calculate total and average of three numbers entered during runtime. III. Design and Program a Calculator. IV. Design and program Fahrenheit to Celsius temperature conversion application. V. Create an application (design and program) using VB with a Textbox control to accept a name from the user and print Hello<Name> in a message box e.g., when user types his name as John in the text box and clicks OK button, a message Hello John should be displayed and if he clicks on cancel button a message as Bye John should appear. VI. Write a program to convert a digit into letters. VII. Write a program to check whether a string is palindrome or not. VIII. Write a program to check whether a single letter is vowel or not. IX. Write a program to check whether a number is positive or negative. X. Write a program of a Timer application.
1
Shariq
Shariq
2. Design a Form to calculate total and average of three numbers entered during runtime.
Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click TextBox4.Text = Val(TextBox1.Text) + Val(TextBox2.Text) + Val(TextBox3.Text) End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click TextBox5.Text = (Val(TextBox1.Text) + Val(TextBox2.Text) + Val(TextBox3.Text)) / 3 End Sub End Class
Shariq
Shariq
Public Class Calculator Dim FirstNumber As Single Dim SecondNumber As Single Dim AnswerNumber As Single Dim ArithmeticProcess As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = TextBox1.Text & "1" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = TextBox1.Text & "2" End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Text = TextBox1.Text & "3" End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click TextBox1.Text = TextBox1.Text & "4" End Sub
5
Shariq
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click TextBox1.Text = TextBox1.Text & "5" End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click TextBox1.Text = TextBox1.Text & "6" End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click TextBox1.Text = TextBox1.Text & "7" End Sub Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click TextBox1.Text = TextBox1.Text & "8" End Sub Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click TextBox1.Text = TextBox1.Text & "9" End Sub Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click TextBox1.Text = TextBox1.Text & "0" End Sub Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click TextBox1.Clear() End Sub Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click TextBox1.Text = TextBox1.Text & "." End Sub Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click FirstNumber = Val(TextBox1.Text) TextBox1.Text = "" ArithmeticProcess = "+"
6
Shariq
End Sub Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click FirstNumber = Val(TextBox1.Text) TextBox1.Text = "" ArithmeticProcess = "-" End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click FirstNumber = Val(TextBox1.Text) TextBox1.Text = "" ArithmeticProcess = "*" End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click FirstNumber = Val(TextBox1.Text) TextBox1.Text = "" ArithmeticProcess = "/" End Sub Private Sub Button17_Click(sender As System.Object, e As System.EventArgs) Handles Button17.Click SecondNumber = Val(TextBox1.Text) If ArithmeticProcess = "+" Then AnswerNumber = FirstNumber + SecondNumber End If If ArithmeticProcess = "-" Then AnswerNumber = FirstNumber - SecondNumber End If If ArithmeticProcess = "*" Then AnswerNumber = FirstNumber * SecondNumber End If If ArithmeticProcess = "/" Then AnswerNumber = FirstNumber / SecondNumber End If TextBox1.Text = AnswerNumber End Sub End Class
Shariq
Shariq
Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click TextBox2.Text = (Val(TextBox1.Text) - 32) / 2 End Sub End Class
Shariq
10
Shariq
5. Create an application (design and program) using VB with a Textbox control to accept a name from the user.
Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Label2.Text = "HELLO " & TextBox1.Text End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click Label2.Text = "BYE " & TextBox1.Text End Sub End Class
11
Shariq
12
Shariq
13
Shariq
14
Shariq
Public Class Form1 Dim a As String Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click a = StrReverse(TextBox1.Text) If a = TextBox1.Text Then Label2.Text = "THIS IS PALINDROME" Else Label2.Text = "THIS IS NOT PALINDROME" End If End Sub End Class
15
Shariq
16
Shariq
Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "a" Then Label2.Text = "VOWEL" ElseIf TextBox1.Text = "e" Then Label2.Text = "VOWEL" ElseIf TextBox1.Text = "i" Then Label2.Text = "VOWEL" ElseIf TextBox1.Text = "o" Then Label2.Text = "VOWEL" ElseIf TextBox1.Text = "u" Then Label2.Text = "VOWEL" ElseIf TextBox1.Text = "A" Then Label2.Text = "VOWEL" ElseIf TextBox1.Text = "E" Then Label2.Text = "VOWEL" ElseIf TextBox1.Text = "I" Then Label2.Text = "VOWEL" ElseIf TextBox1.Text = "O" Then Label2.Text = "VOWEL" ElseIf TextBox1.Text = "U" Then Label2.Text = "VOWEL" Else Label2.Text = "NOT VOWEL" End If
17
Shariq
18
Shariq
Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click If TextBox1.Text < 0 Then Label2.Text = "IT IS NEGATIVE" Else Label2.Text = "IT IS POSITIVE" End If End Sub End Class
19
Shariq
20
Shariq
Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Label1.Text = NumericUpDown1.Text Label3.Text = NumericUpDown2.Text Label5.Text = NumericUpDown3.Text End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click Label1.Text = "00" Label3.Text = "00" Label5.Text = "00" End Sub Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click Timer1.Enabled = True End Sub Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click Timer1.Enabled = False
21
Shariq
End Sub Private Sub Timer1_Tick(sender As System.EventArgs) Handles Timer1.Tick If Label5.Text = 0 Then Label5.Text = 59 Label3.Text = Label3.Text ElseIf Label5.Text > 0 Then Label5.Text = Label5.Text End If If Label3.Text = 0 Then Label1.Text = Label1.Text Label3.Text = 59 End If End Sub End Class System.Object, e As
- 1 - 1 - 1
22
Shariq