0% found this document useful (0 votes)
28 views28 pages

GUI Manual

hi am study in computer eng ty co

Uploaded by

sayedfaizan558
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views28 pages

GUI Manual

hi am study in computer eng ty co

Uploaded by

sayedfaizan558
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Exp-3

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

Dim num As String

num = InputBox("Welcome")

TextBox1.Text = num

End Sub

End Class
Q-2

Public Class Form2

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click

TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click

TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click

TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)

End Sub

End Class
Exp-4

Module Module1

Sub Main()

Dim a, b, c As Integer

Console.WriteLine("enter value for A")

a = Console.ReadLine()

Console.WriteLine("Enter value for b")

b = Console.ReadLine()

Console.WriteLine("Enter the value for c")

c = Console.ReadLine()

If (a > b) Then

If (a > c) Then

Console.WriteLine("a is largest")

Else

Console.WriteLine("c is largest")

End If

Else

If (b > c) Then

Console.WriteLine("B is largest")

Else

Console.WriteLine("C is largest")

End if
End If

Console.ReadLine()

End Sub

End Module
Exp-5

Module Module2

Sub main()

Dim a, b, c As Integer

Dim choice As Integer

Console.WriteLine("1.Addition 2.Subtraction 3.Multiplication 4.Division")

Console.WriteLine("Enter your choice")

choice = Console.ReadLine()

Console.WriteLine("enter value for a")

a = Console.ReadLine()

Console.WriteLine("enter value for b")

b = Console.ReadLine()

Select Case choice

Case 1

c=a+b

Console.WriteLine("Addition is" & c)

Case 2

c=a-b

Console.WriteLine("Subtraction is" & c)

Case 3

c=a*b

Console.WriteLine("Multiplication is" * c)
Case 4

c=a/b

Console.WriteLine("Division is " & c)

Case Else

Console.WriteLine("You have entered rong choice")

End Select

Console.ReadLine()

End Sub

End Module
Exp-6

Module Module7
Sub main()
Dim num As Integer
Dim i As Integer = 2
Dim flag As Integer = 0
Console.WriteLine("Enter one number")
num = Console.ReadLine()
While i <= num / 2
If (num Mod i = 0) Then
flag = 1
End If
i = i + 1
End While
If (flag = 0) Then
Console.WriteLine("Number is prime")
Else
Console.WriteLine("Number is not prime")
End If
Console.ReadLine()
End Sub
End Module
Q-2
Module Module8
Sub main()
Dim i As Integer = 1
While i <= 50
If (i Mod 2 = 0) Then
Console.WriteLine("number is even " & i)
Else
Console.WriteLine("number is odd " & i)

End If
i = i + 1

End While
Console.ReadLine()
End Sub
End Module
Exp-7

Module Module9

Sub main()

Dim i As Integer

For i = 0 To 100 Step 6

Console.WriteLine(i)

Next

Console.ReadLine()

End Sub

End Module
Q-2

Module Module11

Sub main()

Dim arr As Array = {11, 12, 13, 14, 15}

Dim i As Integer

For Each i In arr

Console.WriteLine(i)

Next

Console.ReadLine()

End Sub

End Module

//Output:-
Exp-8

Public Class Form3

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load

Label1.Text = "This is run time provider"

Button1.Text = "Run time button"

End Sub

End Class
Exp-9

Public Class Form8

Dim sum As Integer = 0

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles CheckBox1.CheckedChanged

If CheckBox1.Checked = True Then

sum = sum + Val(CheckBox1.Text)

Else

sum = sum - Val(CheckBox1.Text)

End If

Label1.Text = sum

End Sub

Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles CheckBox2.CheckedChanged

If CheckBox2.Checked = True Then

sum = sum + Val(CheckBox2.Text)

Else

sum = sum - Val(CheckBox2.Text)

End If

Label1.Text = sum

End Sub
Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles CheckBox3.CheckedChanged

If CheckBox3.Checked = True Then

sum = sum + Val(CheckBox3.Text)

Else

sum = sum - Val(CheckBox3.Text)

End If

Label1.Text = sum

End Sub

Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles CheckBox4.CheckedChanged

If CheckBox4.Checked = True Then

sum = sum + Val(CheckBox4.Text)

Else

sum = sum - Val(CheckBox4.Text)

End If

Label1.Text = sum

End Sub

Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles GroupBox1.Enter

End Sub

End Class
Output:-
Q-Radio Button:-

Public Class Form3

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

If RadioButton1.Checked = True Then

MsgBox("You have select " & RadioButton1.Text)

ElseIf RadioButton2.Checked = True Then

MsgBox("You have select " & RadioButton2.Text)

Else

MsgBox("You have select " & RadioButton3.Text)

End If

End Sub

End Class
Exp-10

Public Class Form15

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
ListBox1.SelectedIndexChanged

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

If (Val(TextBox1.Text) Mod 2 = 0) Then

ListBox1.Items.Add(TextBox1.Text)

Else

ListBox2.Items.Add(TextBox1.Text)

End If

End Sub

End Class
Q-Combo Box:-

Public Class Form13

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged

Label1.Text = ComboBox1.SelectedItem

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

ComboBox1.Items.Add(TextBox1.Text)

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click

ComboBox1.Items.Remove(ComboBox1.SelectedItem)

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click

ComboBox1.Sorted = True

ComboBox2.Sorted = True

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles TextBox1.TextChanged

End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged

End Sub

End Class
Exp-11

Public Class Form16

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

PictureBox2.ImageLocation = "C:\User\Downloads\Car.jpg"

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click

PictureBox1.Visible = True

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click

Panel1.Visible = False

Panel2.Visible = True

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click

Panel1.Visible = True

Panel2.Visible = False

End Sub

End Class
Exp-12

Q-1)Program of Tab Control

Public Class Form18

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

Label4.Text = Val(TextBox1.Text) + Val(TextBox2.Text)

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click

Label4.Text = Val(TextBox1.Text) - Val(TextBox2.Text)

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click

Label4.Text = Val(TextBox1.Text) * Val(TextBox2.Text)

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click

Label4.Text = Val(TextBox1.Text) / Val(TextBox2.Text)

End Sub

End Class
Q-2 Program of Timer

Public Class Form20

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick

Label1.Text = Label1.Text + 1

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

Timer1.Start()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click

Timer1.Stop()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click

Label1.Text = 0

End Sub

End Class
Exp-13

Imports System.Text.RegularExpressions

Public Class Form23

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

Dim regex As New Regex("^[89]\d{9}")

Dim isvalid As Boolean = regex.IsMatch(TextBox1.Text)

If isvalid Then

ErrorProvider1.Clear()

Else

ErrorProvider1.SetError(TextBox1, "invalid mobile number")

End If

End Sub

End Class
Exp-14

Imports System.Text.RegularExpressions

Public Class Form24

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

Dim expression As New Regex("\w+@\w+\.\w+")

If expression.IsMatch(TextBox1.Text) Then

ErrorProvider1.Clear()

Else

ErrorProvider1.SetError(TextBox1, "not valid")

End If

End Sub

End Class

You might also like