vbnet (1)
vbnet (1)
PROGRAMME NAME:-BCA
COURSE NAME: VB.NET
End Sub
End Sub
End Sub
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
a = TextBox1.Text
b = TextBox2.Text
c=a/b
TextBox3.Text = c
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
End Sub
End Class
2. Write a program in Visual basic to find whether a given character is vowel or
not .Display the result in a message box.
Imports System.Net.Configuration
Public Class Form1
Dim ch As Char
End Select
End Sub
End Class
3. Create GUI From Show Below and check the eligibility for Voting.
Public Class Form1
Dim age As Integer
End If
End Sub
End Sub
Imports System.Net.Security
End If
End Sub
End Sub
End Class
6. Design and code to print a Table of a given no in textbox.
Public Class Form1
Dim mu As Integer = 1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
While (mu <= 10)
ListBox1.Items.Add(Val(TextBox1.Text) & "*" & mu & "=" & mu * Val(TextBox1.Text))
mu += 1 'mu= mu+1'
ListBox1.Refresh()
End While
End Sub
End Sub
End Sub
End Sub
End Sub
Else
TextBox1.Text = value1 / value2
End If
End Sub
End Class
8. Design and code to generate fibonacii series on a label upto entered limit.
Imports System.Drawing.Imaging
End Sub
End Class
10. Design and coding for selection sorting by using a user define sub routine in
vb.net.
Module Module1
Sub Main()
Dim numbers As Integer() = {5, 2, 9, 1, 5,
6} Console.WriteLine("Original Array:")
PrintArray(numbers)
InsertionSort(numbers)
Console.WriteLine("Sorted Array:")
PrintArray(numbers)
Console.ReadLine() ' To keep the console window open
End Sub
Sub InsertionSort(ByRef arr As Integer())
Dim n As Integer = arr.Length
Dim i, j, key As Integer
For i = 1 To n - 1
key = arr(i)
j=i-1
While j >= 0 AndAlso arr(j) > key
arr(j + 1) = arr(j)
j -= 1
End While
arr(j + 1) =
key
Next
End Sub
Sub PrintArray(arr As Integer())
For Each num As Integer In arr
Console.Write(num & " ")
Next
Console.WriteLine()
End Sub
End Module
Module SelectionSortDemo
Sub Main()
Dim arr() As Integer = {64, 25, 12, 22, 11}
Console.WriteLine("Original array:")
PrintArray(arr)
SelectionSort(arr)
Console.WriteLine("Sorted array:")
PrintArray(arr)
Console.ReadLine()
End Sub
Sub SelectionSort(ByRef array() As Integer)
Dim n As Integer = array.Length
For i As Integer = 0 To n - 2
Dim minIndex As Integer = i
For j As Integer = i + 1 To n - 1
If array(j) < array(minIndex) Then
minIndex = j
End If
Next
If minIndex <> i Then
Dim temp As Integer = array(i)
array(i) = array(minIndex)
array(minIndex) = temp
End If
Next
End Sub
Sub PrintArray(ByVal array() As Integer)
For Each item As Integer In array
Console.Write(item & " ")
Next
Console.WriteLine()
End Sub
End Module
11. Design and coding for insertion sorting by using a user define sub routine in
vb.net.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim inputArray As String() = TextBox1.Text.Split(New String() {Environment.NewLine},
StringSplitOptions.RemoveEmptyEntries)
12. Design and coding for bubble sorting by using a user define sub routine in
vb.net.
Module BubbleSortExample
Sub Main()
Dim numbers() As Integer = {64, 34, 25, 12, 22, 11, 90}
Console.WriteLine("Original Array:")
DisplayArray(numbers)
BubbleSort(numbers)
Console.WriteLine("Sorted Array:")
DisplayArray(numbers)
Module Program
Sub Main()
' Example of Option Explicit
Dim number As Integer = 10 ' Explicitly declaring the variable
Dim text As String = "Hello"
Console.ReadLine()
End Sub
Module MatrixOperations
Sub Main()
' Declare two 2x2 matrices
Dim matrixA(1, 1) As Integer
Dim matrixB(1, 1) As Integer
15. Design and code to check wheather the entered no. is armstrong and
palindrome or not in vb.net.
16. Design and code an application for dynamic array that accept array for the
user and add it to a list box. preserve the values by selecting checkbox in vb.net