Temperature and Palindrome Converter
Temperature and Palindrome Converter
1-
Public Class Form1 Inherits [Link] #Region " Windows Form Designer generated code " Public Sub New() [Link]() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then [Link]() End If End If [Link](disposing) End Sub 'Required by the Windows Form Designer Private components As [Link] 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Label1 As [Link] Friend WithEvents TextBox1 As [Link] Friend WithEvents Button1 As [Link] Friend WithEvents TextBox2 As [Link] Friend WithEvents Label2 As [Link] Friend WithEvents Button2 As [Link] <[Link]()> Private Sub InitializeComponent() Me.Label1 = New [Link] Me.TextBox1 = New [Link] Me.Button1 = New [Link] Me.TextBox2 = New [Link] Me.Label2 = New [Link] Me.Button2 = New [Link] [Link]() ' 'Label1 ' [Link] = [Link] [Link] = New [Link]("Microsoft Sans Serif", 10.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](32, 48) [Link] = "Label1"
[Link] = New [Link](120, 24) [Link] = 0 [Link] = "Enter Temperature" ' 'TextBox1 ' [Link] = New [Link](168, 48) [Link] = "TextBox1" [Link] = New [Link](216, 20) [Link] = 1 [Link] = "" ' 'Button1 ' [Link] = [Link] [Link] = [Link] [Link] = New [Link](96, 160) [Link] = "Button1" [Link] = New [Link](248, 40) [Link] = 2 [Link] = "Convert Celcius to Ferrenheit" ' 'TextBox2 ' [Link] = New [Link](168, 104) [Link] = "TextBox2" [Link] = New [Link](216, 20) [Link] = 3 [Link] = "" ' 'Label2 ' [Link] = [Link] [Link] = New [Link]("Microsoft Sans Serif", 10.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](32, 104) [Link] = "Label2" [Link] = New [Link](120, 24) [Link] = 4 [Link] = "Results" ' 'Button2 ' [Link] = [Link] [Link] = [Link] [Link] = New [Link](96, 224) [Link] = "Button2" [Link] = New [Link](248, 40) [Link] = 5 [Link] = "Convert Ferrenheit to Celcius" ' 'Form1 ' [Link] = New [Link](5, 13) [Link] = [Link] [Link] = New [Link](432, 310) [Link](Me.Button2) [Link](Me.Label2) [Link](Me.TextBox2) [Link](Me.Button1)
[Link](Me.TextBox1) [Link](Me.Label1) [Link] = "Form1" [Link] = "Form1" [Link](False) End Sub #End Region Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim c, f As Double c = [Link] f = (1.8 * c) + 32 [Link] = f End Sub Private Sub Button2_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim f, c As Double f = [Link] c = (f - 32) / 1.8 [Link] = c End Sub End Class
OUTPUT:
Ques. 2not.
Public Class Form1 Inherits [Link] #Region " Windows Form Designer generated code " Public Sub New() [Link]() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then [Link]() End If End If [Link](disposing) End Sub 'Required by the Windows Form Designer Private components As [Link] 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Label1 As [Link] Friend WithEvents TextBox1 As [Link] Friend WithEvents Button1 As [Link] <[Link]()> Private Sub InitializeComponent() Me.Label1 = New [Link] Me.TextBox1 = New [Link] Me.Button1 = New [Link] [Link]() ' 'Label1 ' [Link] = New [Link]("Microsoft Sans Serif", 10.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](24, 72) [Link] = "Label1" [Link] = New [Link](104, 24) [Link] = 0 [Link] = "Enter a string" ' 'TextBox1 ' [Link] = New [Link](144, 72) [Link] = "TextBox1"
[Link] = New [Link](232, 20) [Link] = 1 [Link] = "" ' 'Button1 ' [Link] = [Link] [Link] = [Link] [Link] = New [Link](136, 168) [Link] = "Button1" [Link] = New [Link](184, 48) [Link] = 2 [Link] = "Check Palindrome" ' 'Form1 ' [Link] = New [Link](5, 13) [Link] = [Link] [Link] = New [Link](432, 270) [Link](Me.Button1) [Link](Me.TextBox1) [Link](Me.Label1) [Link] = "Form1" [Link] = "Form1" [Link](False) End Sub #End Region Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim str1, str2 As String str1 = [Link] str2 = StrReverse(str1) If str2 = str1 Then MsgBox("The string is Palindrome") Else MsgBox("The string is not Palindrome") End If End Sub End Class
OUTPUT:
[Link] = New [Link](192, 20) [Link] = 1 [Link] = "" ' 'Label1 ' [Link] = New [Link]("Microsoft Sans Serif", 10.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](16, 48) [Link] = "Label1" [Link] = New [Link](120, 24) [Link] = 2 [Link] = "Enter a String" ' 'Form1 ' [Link] = New [Link](5, 13) [Link] = [Link] [Link] = New [Link](352, 286) [Link](Me.Label1) [Link](Me.TextBox1) [Link](Me.Button1) [Link] = "Form1" [Link] = "Form1" [Link](False) End Sub #End Region Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim arr1(10), arr2(10) As String Dim i, j, len As Integer arr1(i) = [Link] len = [Link] For i = 0 To len arr1(i) = [Link](i, 1) Next For i = len To 0 Step -1 For j = 0 To len arr2(j) = arr1(i) Next Next If arr2 Is arr1 Then MsgBox("The string is palindrome") Else MsgBox("The string is not palindrome") End If End Sub End Class
Ques. 4-
Public Class Form1 Inherits [Link] #Region " Windows Form Designer generated code " Public Sub New() [Link]() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then [Link]() End If End If [Link](disposing) End Sub 'Required by the Windows Form Designer Private components As [Link] 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Label1 As [Link] Friend WithEvents Label2 As [Link] Friend WithEvents Label3 As [Link] Friend WithEvents Label4 As [Link] Friend WithEvents Label5 As [Link] Friend WithEvents Label6 As [Link] Friend WithEvents Label7 As [Link] Friend WithEvents TextBox1 As [Link] Friend WithEvents TextBox2 As [Link] Friend WithEvents TextBox3 As [Link] Friend WithEvents TextBox4 As [Link] Friend WithEvents TextBox5 As [Link] Friend WithEvents TextBox6 As [Link] Friend WithEvents TextBox7 As [Link] Friend WithEvents Button1 As [Link] <[Link]()> Private Sub InitializeComponent() Me.Label1 = New [Link] Me.Label2 = New [Link] Me.Label3 = New [Link] Me.Label4 = New [Link] Me.Label5 = New [Link] Me.Label6 = New [Link] Me.Label7 = New [Link] Me.TextBox1 = New [Link] Me.TextBox2 = New [Link] Me.TextBox3 = New [Link]
Me.TextBox4 = New [Link] Me.TextBox5 = New [Link] Me.TextBox6 = New [Link] Me.TextBox7 = New [Link] Me.Button1 = New [Link] [Link]() ' 'Label1 ' [Link] = New [Link]("Microsoft Sans Serif", 10.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](24, 40) [Link] = "Label1" [Link] = New [Link](144, 32) [Link] = 0 [Link] = "Member Name" ' 'Label2 ' [Link] = New [Link]("Microsoft Sans Serif", 10.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](24, 96) [Link] = "Label2" [Link] = New [Link](144, 32) [Link] = 1 [Link] = "Address" ' 'Label3 ' [Link] = New [Link]("Microsoft Sans Serif", 10.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](24, 152) [Link] = "Label3" [Link] = New [Link](144, 32) [Link] = 2 [Link] = "Phone Number" ' 'Label4 ' [Link] = New [Link]("Microsoft Sans Serif", 10.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](336, 40) [Link] = "Label4" [Link] = New [Link](136, 32) [Link] = 3 [Link] = "Book Name" ' 'Label5 ' [Link] = New [Link]("Microsoft Sans Serif", 10.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](336, 96) [Link] = "Label5"
[Link] = New [Link](136, 32) [Link] = 4 [Link] = "Date Of Issue" ' 'Label6 ' [Link] = New [Link]("Microsoft Sans Serif", 10.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](336, 152) [Link] = "Label6" [Link] = New [Link](136, 32) [Link] = 5 [Link] = "Date Of Return" ' 'Label7 ' [Link] = New [Link]("Microsoft Sans Serif", 10.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](216, 216) [Link] = "Label7" [Link] = New [Link](112, 32) [Link] = 6 [Link] = "Fine Ammount" ' 'TextBox1 ' [Link] = New [Link](176, 32) [Link] = "TextBox1" [Link] = New [Link](144, 20) [Link] = 7 [Link] = "" ' 'TextBox2 ' [Link] = New [Link](176, 96) [Link] = "TextBox2" [Link] = New [Link](144, 20) [Link] = 8 [Link] = "" ' 'TextBox3 ' [Link] = New [Link](176, 152) [Link] = "TextBox3" [Link] = New [Link](144, 20) [Link] = 9 [Link] = "" ' 'TextBox4 ' [Link] = New [Link](488, 40) [Link] = "TextBox4" [Link] = New [Link](144, 20) [Link] = 10 [Link] = "" ' 'TextBox5 ' [Link] = New [Link](488, 96)
[Link] = "TextBox5" [Link] = New [Link](144, 20) [Link] = 11 [Link] = "" ' 'TextBox6 ' [Link] = New [Link](488, 152) [Link] = "TextBox6" [Link] = New [Link](144, 20) [Link] = 12 [Link] = "" ' 'TextBox7 ' [Link] = New [Link](352, 216) [Link] = "TextBox7" [Link] = New [Link](144, 20) [Link] = 13 [Link] = "" [Link] = False ' 'Button1 ' [Link] = [Link] [Link] = New [Link]("Microsoft Sans Serif", 20.0!, [Link], [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](168, 312) [Link] = "Button1" [Link] = New [Link](368, 56) [Link] = 14 [Link] = "Check For Fine" ' 'Form1 ' [Link] = New [Link](5, 13) [Link] = [Link] [Link] = New [Link](672, 406) [Link](Me.Button1) [Link](Me.TextBox7) [Link](Me.TextBox6) [Link](Me.TextBox5) [Link](Me.TextBox4) [Link](Me.TextBox3) [Link](Me.TextBox2) [Link](Me.TextBox1) [Link](Me.Label7) [Link](Me.Label6) [Link](Me.Label5) [Link](Me.Label4) [Link](Me.Label3) [Link](Me.Label2) [Link](Me.Label1) [Link] = "Form1" [Link] = "Form1" [Link](False) End Sub #End Region
Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim dt1, dt2 As Date Dim diff_date, fine As Integer Dim temp As Object dt1 = [Link] dt2 = [Link] diff_date = DateDiff("d", dt1, dt2) If diff_date = 0 Then MsgBox("No fine") ElseIf diff_date < 0 Then MsgBox("No fine") Else fine = diff_date * 5 [Link] = fine [Link] = True End If temp = [Link] If temp = Nothing Then temp = "Nil" [Link] = temp End If [Link] = True End Sub End Class
OUTPUT:
Ques. 5- Find the length of a given string entered in a text box and show it in another text box.
Public Class Form1 Inherits [Link] #Region " Windows Form Designer generated code " Public Sub New() [Link]() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then [Link]() End If End If [Link](disposing) End Sub 'Required by the Windows Form Designer Private components As [Link] 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents MainMenu1 As [Link] Friend WithEvents Label1 As [Link] Friend WithEvents TextBox1 As [Link] Friend WithEvents Button1 As [Link] Friend WithEvents Label2 As [Link] Friend WithEvents TextBox2 As [Link] <[Link]()> Private Sub InitializeComponent() [Link] = New [Link] Me.MainMenu1 = New [Link]([Link]) Me.Label1 = New [Link] Me.TextBox1 = New [Link] Me.Button1 = New [Link] Me.TextBox2 = New [Link] Me.Label2 = New [Link] [Link]() ' 'Label1 ' [Link] = New [Link]("Monotype Corsiva", 12.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](24, 48) [Link] = "Label1" [Link] = New [Link](93, 24) [Link] = 0
[Link] = "Enter the text" ' 'TextBox1 ' [Link] = New [Link](136, 48) [Link] = "TextBox1" [Link] = New [Link](117, 20) [Link] = 1 ' 'Button1 ' [Link] = New [Link]("Monotype Corsiva", 12.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](80, 136) [Link] = "Button1" [Link] = New [Link](116, 38) [Link] = 2 [Link] = "length of string" ' 'TextBox2 ' [Link] = New [Link](136, 201) [Link] = "TextBox2" [Link] = New [Link](117, 20) [Link] = 3 ' 'Label2 ' [Link] = True [Link] = New [Link]("Monotype Corsiva", 12.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](24, 201) [Link] = "Label2" [Link] = New [Link](46, 18) [Link] = 4 [Link] = "Result" ' 'Form1 ' [Link] = New [Link](4, 13) [Link] = [Link](CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(255, Byte), Integer)) [Link] = New [Link](292, 273) [Link](Me.Label2) [Link](Me.TextBox2) [Link](Me.Button1) [Link](Me.TextBox1) [Link](Me.Label1) [Link] = New [Link]("Monotype Corsiva", 8.25!, [Link], [Link], CType(0, Byte)) [Link] = Me.MainMenu1 [Link] = "Form1" [Link] = "DPS" [Link](False) [Link]() End Sub #End Region
Private Sub Form1_Load(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim a As Integer End Sub Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim str As String Dim l As Integer str = [Link] l = Len(str) [Link] = l End Sub End Class
OUTPUT:
Ques.6- Take user input in structure variable and then display them through msgbox()
Public Class Form1 Inherits [Link] #Region " Windows Form Designer generated code " Public Sub New() [Link]() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then [Link]() End If End If [Link](disposing) End Sub 'Required by the Windows Form Designer Private components As [Link] 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Label2 As [Link] Friend WithEvents Label3 As [Link] Friend WithEvents Label4 As [Link] Friend WithEvents Label5 As [Link] Friend WithEvents TextBox2 As [Link] Friend WithEvents TextBox3 As [Link] Friend WithEvents TextBox4 As [Link] Friend WithEvents TextBox5 As [Link] Friend WithEvents Button1 As [Link] Friend WithEvents TextBox1 As [Link] Friend WithEvents Label1 As [Link] <[Link]()> Private Sub InitializeComponent() Me.Label2 = New [Link]() Me.Label3 = New [Link]() Me.Label4 = New [Link]() Me.Label5 = New [Link]() Me.TextBox2 = New [Link]() Me.TextBox3 = New [Link]() Me.TextBox4 = New [Link]() Me.TextBox5 = New [Link]() Me.Button1 = New [Link]() Me.TextBox1 = New [Link]() Me.Label1 = New [Link]() [Link]() ' 'Label2
' [Link] = New [Link]("Monotype Corsiva", 12.0!, ([Link] Or [Link]), [Link], CType(0, Byte)) [Link] = New [Link](8, 216) [Link] = "Label2" [Link] = New [Link](88, 16) [Link] = 2 [Link] = "Salary" ' 'Label3 ' [Link] = New [Link]("Monotype Corsiva", 12.0!, ([Link] Or [Link]), [Link], CType(0, Byte)) [Link] = New [Link](8, 168) [Link] = "Label3" [Link] = New [Link](88, 16) [Link] = 3 [Link] = "Designation" ' 'Label4 ' [Link] = New [Link]("Monotype Corsiva", 12.0!, ([Link] Or [Link]), [Link], CType(0, Byte)) [Link] = New [Link](8, 120) [Link] = "Label4" [Link] = New [Link](88, 16) [Link] = 4 [Link] = "Department" ' 'Label5 ' [Link] = New [Link]("Monotype Corsiva", 12.0!, ([Link] Or [Link]), [Link], CType(0, Byte)) [Link] = New [Link](8, 72) [Link] = "Label5" [Link] = New [Link](88, 16) [Link] = 5 [Link] = "Name" ' 'TextBox2 ' [Link] = New [Link](136, 112) [Link] = "TextBox2" [Link] = New [Link](104, 20) [Link] = 6 [Link] = "" ' 'TextBox3 ' [Link] = New [Link](136, 160) [Link] = "TextBox3" [Link] = New [Link](104, 20) [Link] = 7 [Link] = "" '
'TextBox4 ' [Link] = New [Link](136, 208) [Link] = "TextBox4" [Link] = New [Link](104, 20) [Link] = 8 [Link] = "" ' 'TextBox5 ' [Link] = New [Link](136, 64) [Link] = "TextBox5" [Link] = New [Link](104, 20) [Link] = 9 [Link] = "" ' 'Button1 ' [Link] = New [Link]("Monotype Corsiva", 12.0!, ([Link] Or [Link]), [Link], CType(0, Byte)) [Link] = New [Link](80, 248) [Link] = "Button1" [Link] = New [Link](128, 24) [Link] = 10 [Link] = "SUBMIT" ' 'TextBox1 ' [Link] = New [Link](136, 24) [Link] = "TextBox1" [Link] = New [Link](104, 20) [Link] = 1 [Link] = "" ' 'Label1 ' [Link] = [Link](CType(192, Byte), CType(192, Byte), CType(255, Byte)) [Link] = New [Link]("Monotype Corsiva", 12.0!, ([Link] Or [Link]), [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](8, 24) [Link] = "Label1" [Link] = New [Link](88, 16) [Link] = 0 [Link] = "ENo" ' 'Form1 ' [Link] = New [Link](5, 13) [Link] = [Link](CType(192, Byte), CType(192, Byte), CType(255, Byte)) [Link] = New [Link](292, 301) [Link](New [Link]() {Me.Button1, Me.TextBox5, Me.TextBox4, Me.TextBox3, Me.TextBox2, Me.Label5, Me.Label4, Me.Label3, Me.Label2, Me.TextBox1, Me.Label1}) [Link] = [Link] [Link] = "Form1" [Link] = "Form1"
[Link](False) End Sub #End Region Structure employee Dim eno As Integer Dim name As String Dim department As String Dim designation As String Dim salary As Integer End Structure Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim emp1 As employee [Link] = [Link] [Link] = [Link] [Link] = [Link] [Link] = [Link] [Link] = [Link] MsgBox([Link] & [Link] & [Link] & [Link] & [Link]) End Sub End Class
OUTPUT:
Me.RadioButton1 = New [Link] Me.Label9 = New [Link] Me.Label8 = New [Link] Me.Label7 = New [Link] Me.Label6 = New [Link] Me.Label5 = New [Link] Me.Label4 = New [Link] Me.Label3 = New [Link] Me.Label2 = New [Link] Me.Timer1 = New [Link]([Link]) Me.Timer2 = New [Link]([Link]) Me.Timer3 = New [Link]([Link]) Me.Timer4 = New [Link]([Link]) Me.Label10 = New [Link] [Link]() [Link]() ' 'Label1 ' [Link] = True [Link] = New [Link]("Microsoft Sans Serif", 17.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](24, 56) [Link] = "Label1" [Link] = New [Link](118, 29) [Link] = 0 [Link] = "Question-" ' 'GroupBox1 ' [Link](Me.RadioButton4) [Link](Me.RadioButton3) [Link](Me.RadioButton2) [Link](Me.RadioButton1) [Link](Me.Label9) [Link](Me.Label8) [Link](Me.Label7) [Link](Me.Label6) [Link](Me.Label5) [Link](Me.Label4) [Link](Me.Label3) [Link](Me.Label2) [Link] = New [Link](24, 120) [Link] = "GroupBox1" [Link] = New [Link](392, 136) [Link] = 2 [Link] = False [Link] = "Options" ' 'RadioButton4 ' [Link] = New [Link](216, 88) [Link] = "RadioButton4" [Link] = New [Link](16, 24) [Link] = 11 ' 'RadioButton3 ' [Link] = New [Link](216, 32) [Link] = "RadioButton3" [Link] = New [Link](16, 24) [Link] = 10
' 'RadioButton2 ' [Link] = New [Link](37, 88) [Link] = "RadioButton2" [Link] = New [Link](16, 24) [Link] = 9 ' 'RadioButton1 ' [Link] = New [Link](37, 32) [Link] = "RadioButton1" [Link] = New [Link](16, 24) [Link] = 8 [Link] = False ' 'Label9 ' [Link] = True [Link] = [Link](CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) [Link] = New [Link]("Microsoft Sans Serif", 15.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](238, 88) [Link] = "Label9" [Link] = New [Link](62, 25) [Link] = 7 [Link] = "Cycle" [Link] = False ' 'Label8 ' [Link] = True [Link] = [Link](CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) [Link] = New [Link]("Microsoft Sans Serif", 15.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](238, 32) [Link] = "Label8" [Link] = New [Link](107, 25) [Link] = 6 [Link] = "Motorcycle" [Link] = False ' 'Label7 ' [Link] = True [Link] = [Link](CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) [Link] = New [Link]("Microsoft Sans Serif", 15.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](59, 87) [Link] = "Label7" [Link] = New [Link](69, 25) [Link] = 5 [Link] = "scooty" [Link] = False
' 'Label6 ' [Link] = True [Link] = [Link](CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) [Link] = New [Link]("Microsoft Sans Serif", 15.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](59, 32) [Link] = "Label6" [Link] = New [Link](80, 25) [Link] = 4 [Link] = "Scooter" [Link] = False ' 'Label5 ' [Link] = True [Link] = New [Link]("Microsoft Sans Serif", 13.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](192, 88) [Link] = "Label5" [Link] = New [Link](23, 22) [Link] = 3 [Link] = "D" ' 'Label4 ' [Link] = True [Link] = New [Link]("Microsoft Sans Serif", 13.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](192, 32) [Link] = "Label4" [Link] = New [Link](22, 22) [Link] = 2 [Link] = "B" ' 'Label3 ' [Link] = True [Link] = New [Link]("Microsoft Sans Serif", 13.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](16, 88) [Link] = "Label3" [Link] = New [Link](23, 22) [Link] = 1 [Link] = "C" ' 'Label2 ' [Link] = True [Link] = New [Link]("Microsoft Sans Serif", 13.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](16, 32) [Link] = "Label2" [Link] = New [Link](22, 22) [Link] = 0
[Link] = "A" ' 'Timer1 ' [Link] = True [Link] = 1100 ' 'Timer2 ' [Link] = True [Link] = 2100 ' 'Timer3 ' [Link] = True [Link] = 3100 ' 'Timer4 ' [Link] = True [Link] = 4100 ' 'Label10 ' [Link] = True [Link] = New [Link]("Microsoft Sans Serif", 17.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](184, 56) [Link] = "Label10" [Link] = New [Link](232, 29) [Link] = 3 [Link] = "Pick the odd one out" ' 'Form1 ' [Link] = New [Link](5, 13) [Link] = [Link](CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(255, Byte), Integer)) [Link] = New [Link](554, 349) [Link](Me.Label10) [Link](Me.GroupBox1) [Link](Me.Label1) [Link] = "Form1" [Link] = "Form1" [Link](False) [Link]() [Link](False) [Link]() End Sub #End Region Private Sub Timer1_Tick(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] [Link]() [Link] = True [Link] = True [Link]() End Sub
Private Sub Timer2_Tick(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] [Link]() [Link] = True [Link]() End Sub Private Sub Timer3_Tick(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] [Link]() [Link] = True [Link]() End Sub Private Sub Timer4_Tick(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] [Link]() [Link] = True [Link]() End Sub End Class
OUTPUT:
[Link](False) End Sub #End Region Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim frm2 As New Form2() [Link]() End Sub End Class
[Link] = New [Link](24, 128) [Link] = "Button1" [Link] = New [Link](112, 40) [Link] = 0 [Link] = "Ok" ' 'Button2 ' [Link] = [Link] [Link] = New [Link]("Microsoft Sans Serif", 11.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](160, 128) [Link] = "Button2" [Link] = New [Link](112, 40) [Link] = 1 [Link] = "Cancel" ' 'Form2 ' [Link] = New [Link](5, 13) [Link] = New [Link](292, 273) [Link](New [Link]() {Me.Button2, Me.Button1}) [Link] = "Form2" [Link] = "Form2" [Link](False) End Sub #End Region Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] MsgBox("The OK Button") End Sub Private Sub Button2_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] MsgBox("The Cancel Button") End Sub End Class
OUTPUT:
Ques.9- Give an example to use classes in [Link] and calling its member functions. Coding for the class i.e. taxclass :
Public Class taxclass Overloads Function taxamount(ByVal decprice As Decimal, ByVal taxrate As Single) As String taxamount = CStr(decprice * taxrate) End Function Overloads Function taxamount(ByVal strprice As String, ByVal taxrate As Single) As String taxamount = CStr(CDec(strprice) * taxrate) End Function End Class
Public Class Form1 Inherits [Link] #Region " Windows Form Designer generated code " Public Sub New() [Link]() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then [Link]() End If End If [Link](disposing) End Sub 'Required by the Windows Form Designer Private components As [Link] 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Button1 As [Link] <[Link]()> Private Sub InitializeComponent() Me.Button1 = New [Link]() [Link]() ' 'Button1 ' [Link] = New [Link]("Book Antiqua", 15.75!, ([Link] Or [Link]), [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](64, 80) [Link] = "Button1" [Link] = New [Link](184, 40) [Link] = 0 [Link] = "Show Tax"
' 'Form1 ' [Link] = New [Link](5, 13) [Link] = [Link](CType(192, Byte), CType(192, Byte), CType(255, Byte)) [Link] = New [Link](292, 273) [Link](New [Link]() {Me.Button1}) [Link] = [Link](CType(192, Byte), CType(192, Byte), CType(255, Byte)) [Link] = "Form1" [Link] = "Form1" [Link](False) End Sub #End Region Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] showtax() End Sub Sub showtax() Const taxrate As Single = 0.08 '8% tax rate' Dim strprice As String = "64.00" Dim decprice As Decimal = 64 Dim aclass As New taxclass() MsgBox([Link](strprice, taxrate)) MsgBox([Link](decprice, taxrate)) End Sub End Class
OUTPUT:
Ques.10- Swap two values using a function and passing the values by reference.
Public Class Form1 Inherits [Link] #Region " Windows Form Designer generated code " Public Sub New() [Link]() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then [Link]() End If End If [Link](disposing) End Sub 'Required by the Windows Form Designer Private components As [Link] 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents LinkLabel1 As [Link] Friend WithEvents LinkLabel2 As [Link] Friend WithEvents TextBox1 As [Link] Friend WithEvents TextBox2 As [Link] Friend WithEvents Button1 As [Link] <[Link]()> Private Sub InitializeComponent() Me.LinkLabel1 = New [Link] Me.LinkLabel2 = New [Link] Me.TextBox1 = New [Link] Me.TextBox2 = New [Link] Me.Button1 = New [Link] [Link]() ' 'LinkLabel1 ' [Link] = True [Link] = New [Link]("Monotype Corsiva", 16.0!, CType(([Link] Or [Link]), [Link]), [Link], CType(0, Byte)) [Link] = New [Link](48, 48) [Link] = "LinkLabel1" [Link] = New [Link](79, 26) [Link] = 0 [Link] = True [Link] = "Value 1" 'LinkLabel2 [Link] = True [Link] = New [Link]("Monotype Corsiva", 16.0!, CType(([Link] Or [Link]), [Link]), [Link], CType(0, Byte))
[Link] = New [Link](48, 112) [Link] = "LinkLabel2" [Link] = New [Link](79, 26) [Link] = 1 [Link] = True [Link] = "Value 2" 'TextBox1 [Link] = New [Link]("Microsoft Sans Serif", 14.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](208, 40) [Link] = "TextBox1" [Link] = New [Link](100, 29) [Link] = 2 'TextBox2 [Link] = New [Link]("Microsoft Sans Serif", 14.0!, [Link], [Link], CType(0, Byte)) [Link] = New [Link](208, 104) [Link] = "TextBox2" [Link] = New [Link](100, 29) [Link] = 3 'Button1 [Link] = New [Link]("Monotype Corsiva", 18.0!, CType(([Link] Or [Link]), [Link]), [Link], CType(0, Byte)) [Link] = [Link] [Link] = New [Link](144, 176) [Link] = "Button1" [Link] = New [Link](134, 50) [Link] = 4 [Link] = "SWAP" 'Form1 [Link] = New [Link](5, 13) [Link] = New [Link](435, 273) [Link](Me.Button1) [Link](Me.TextBox2) [Link](Me.TextBox1) [Link](Me.LinkLabel2) [Link](Me.LinkLabel1) [Link] = [Link](CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(255, Byte), Integer)) [Link] = "Form1" [Link] = "Form1" [Link](False) [Link]() End Sub #End Region Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim a, b As Integer Dim res As Boolean a = CInt([Link]) b = CInt([Link]) res = swap(a, b) If res Then MsgBox("Swap successfully done") End If [Link] = CStr(a) [Link] = CStr(b) End Sub
Function swap(ByRef x As Integer, ByRef y As Integer) As Boolean Dim t As Integer t = x x = y y = t MsgBox("Value 1 after swap:" & x & Chr(13) & "Value after swap:" & y) swap = True End Function End Class
OUTPUT: