Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Gad Experiments

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Experiment.

5
Imports System

Module Program
Sub Main(args As String())
Dim grade As Char
Console.WriteLine("Enter your Grades !!!")
grade = Console.ReadLine()

Select Case grade


Case "A", "a"
Console.WriteLine("Distinction !!!")
Case "B", "b"
Console.WriteLine("First Class !!!")
Case "C", "c"
Console.WriteLine("Second Class !!!")
Case "D", "d"
Console.WriteLine("Fail !!!")
Case Else
Console.WriteLine("Not a valid Grade.")
End Select

End Sub
End Module
Imports System
Module Program
Sub Main(args As String())
Dim n As Char
Console.WriteLine("Enter a Letter !!!")
n = Console.ReadLine()
Select Case n
Case "A", "a"
Console.WriteLine("The entered letter is a vowel")
Case "E", "e"
Console.WriteLine("The entered letter is a vowel")
Case "I", "i"
Console.WriteLine("The entered letter is a vowel")
Case "O", "o"
Console.WriteLine("The entered letteris a vowel")
Case "U", "u"
Console.WriteLine("The entered letter is a vowel")
Case Else
Console.WriteLine("The entered letter is a not vowel or it is not a character")
End Select

End Sub
End Module
Imports System

Module Program
Sub Main(args As String())
Dim a, b, r As Double
Dim operation As Char
Console.WriteLine("Enter two numbers !!!")
a = Console.ReadLine()
b = Console.ReadLine()
Console.WriteLine("Enter operation to be performed !!!")
operation = Console.ReadLine()
Select Case operation
Case "ADD", "add"
r=a+b
Console.WriteLine("Addition is " & r)
Case "SUB", "sub"
r=a-b
Console.WriteLine("Subtraction is " & r)
Case "MUL", "mul"
r=a*b
Console.WriteLine("Multiplication is " & r)
Case "DIV", "div"
r=a/b
Console.WriteLine("Division is " & r)
Case Else
Console.WriteLine("Enter the operation correctly !!!")
End Select

End Sub
End Module
Experiment.6
Module Module1
Sub Main()
Dim count As Integer = 1
While count <= 5
Console.WriteLine("While loop iteration : " & count)
count += 1
End While
Dim anotherCount As Integer = 1
Do
Console.WriteLine("Do loop iteration : " & anotherCount)
anotherCount += 1
Loop While anotherCount <= 5
Console.ReadLine()
End Sub
End Module
Experiment.8

Public Class Form1


Private Sub
Button1_Click(sender As
Object, e As EventArgs)
Handles Button1.Click
MsgBox("Submitted !!!")

End Sub
End Class

Public Class Form1


Private Sub Form1_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
Dim b As New Button
b.Text = "BUTTON"
Me.Controls.Add(b)
End Sub
End Class

Imports System.DirectoryServices

Public Class Form1


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.BackColor = System.Drawing.Color.Pink
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Dim a, b, r As Integer
a = TextBox1.Text
b = TextBox2.Text
r=a+b
MsgBox("Addition is " & r)
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


Dim a, b, r As Integer
a = TextBox1.Text
b = TextBox2.Text
r=a-b
MsgBox("Subtraction is " & r)
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Dim a, b, r As Integer
a = TextBox1.Text
b = TextBox2.Text
r=a*b
MsgBox("Multiplication is " & r)
End Sub

Private Sub Button4_Click(sender As


Object, e As EventArgs) Handles
Button4.Click
Dim a, b, r As Integer
a = TextBox1.Text
b = TextBox2.Text
r=a/b
MsgBox("Division is " & r)
End Sub
End Class
Imports System.Drawing.Color
Public Class Form1
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles
Label1.Click
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Me.BackColor = System.Drawing.Color.DarkRed
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click
Me.BackColor = System.Drawing.Color.SkyBlue
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
Button3.Click
Me.BackColor = System.Drawing.Color.DarkOrange
End Sub
End Class
Experiment.9
Imports System.Diagnostics.Eventing.Reader

Public Class Form1


Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles
CheckBox1.CheckedChanged

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Dim s As String
If CheckBox1.Checked = True Then
s &= vbCrLf + CheckBox1.Text
End If
If CheckBox2.Checked = True Then
s &= vbCrLf + CheckBox2.Text
End If
If CheckBox3.Checked = True Then
s &= vbCrLf + CheckBox3.Text
End If
If CheckBox4.Checked = True Then
s &= vbCrLf + CheckBox4.Text
End If
If CheckBox5.Checked = True Then
s &= vbCrLf + CheckBox5.Text
End If
If CheckBox6.Checked = True Then
s &= vbCrLf + CheckBox6.Text
End If
If s <> Nothing Then
MsgBox("Selected items are :" & s)
Else
MsgBox("No Items selected")
End If
End Sub
End Class
Imports System.Diagnostics.Eventing.Reader
Public Class Form1
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton1.CheckedChanged
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim s As String
s = ""
If RadioButton1.Checked = True Then
s &= vbCrLf + RadioButton1.Text
ElseIf RadioButton2.Checked = True Then
s &= vbCrLf + RadioButton2.Text
End If
If s <> Nothing Then
MsgBox("Selected Gender is :" & s)
Else
MsgBox("No Gender selected !!!")
End If
End Sub
End Class
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.BackColor = System.Drawing.Color.Black
PictureBox1.Hide()
PictureBox2.Hide()
End Sub
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton1.CheckedChanged
PictureBox1.Show()
PictureBox2.Hide()
PictureBox1.ImageLocation = "C:\Users\sawan\Videos/bulb.on.png"
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
End Sub
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton2.CheckedChanged
PictureBox2.Show()
PictureBox1.Hide()
PictureBox2.ImageLocation = "C:\Users\sawan\Videos/bulb.off.png"
PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage
End Sub
End Class

You might also like