1) Write a VB.
Net Program to display the numbers continuously in TextBox by clicking on
Button.
Public Class Form1
Dim counter As Integer
Private Sub Form1_Load(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
counter = 0
[Link] = True
End Sub
Private Sub Timer1_Tick(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
counter = counter + 1
[Link] = counter
End Sub
End Class
2) Write a [Link] program to move the Text “Pune University” continuously from Left
to Right and Vice Versa.
Public Class MoveText
Private Sub MoveText_Load(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = True
End Sub
Private Sub Timer1_Tick(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] += 1
If [Link] >= 12000 Then
[Link] = False
End If
End Sub
End Class
3) Write a program in C# .Net to create a function for the sum of two numbers.
using System;
namespace Add{
public class Program{
public static int addition(int a, int b){
return (a+b);
}
public static void Main(){
int a,b;
int sum;
[Link]("Enter first number: ");
a = Convert.ToInt32([Link]());
[Link]("Enter second number: ");
b = Convert.ToInt32([Link]());
sum = addition(a,b);
[Link]("Sum is: " + sum);
}} }
4) Write a [Link] program to accept a character from keyboard and check whether it
is vowel or consonant. Also display the case of that character.
Public Class VowelCheck
Private Sub btnvowel_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
Dim c As Char
c = [Link]
If [Link](c) Then
MsgBox("Upper Case Character")
ElseIf [Link](c) Then
MsgBox("Lower Case Character")
End If
Select Case c
Case "A"
MsgBox("Vowel")
Case "B"
MsgBox("Vowel")
Case "C"
MsgBox("Vowel")
Case "D"
MsgBox("Vowel")
Case "E"
MsgBox("Vowel")
Case "a"
MsgBox("Vowel")
Case "b"
MsgBox("Vowel")
Case "c"
MsgBox("Vowel")
Case "d"
MsgBox("Vowel")
Case "e"
MsgBox("Vowel")
Case Else
MsgBox("Not Vowel")
End Select
End Sub
End Class
5) Design a [Link] form to pick a date from DateTimePicker Control and display day, month
and year in separate text boxes.
Public Class DateTimepker
Private Sub DateTimePicker1_ValueChanged(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link]
[Link] = [Link]
[Link] = [Link]
End Sub
End Class
6) Write a c#.Net program for multiplication of matrices.
using System;
public class Exercise21
{
public static void Main()
{
int i,j,k,r1,c1,r2,c2,sum=0;
int[,] arr1 = new int[50,50];
int[,] brr1 = new int[50,50];
int[,] crr1 = new int[50,50];
[Link]("\n\nMultiplication of two Matrices\n");
[Link]("----------------------------------\n");
[Link]("\nInput the number of rows and columns of the first matrix :\n");
[Link]("Rows : ");
r1 = Convert.ToInt32([Link]());
[Link]("Columns : ");
c1 = Convert.ToInt32([Link]());
[Link]("\nInput the number of rows of the second matrix :\n");
[Link]("Rows : ");
r2 = Convert.ToInt32([Link]());
[Link]("Columns : ");
c2 = Convert.ToInt32([Link]());
if(c1!=r2){
[Link]("Mutiplication of Matrix is not possible.");
[Link]("\nColumn of first matrix and row of second matrix must be same.");
}
else
{
[Link]("Input elements in the first matrix :\n");
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++)
{
[Link]("element - [{0}],[{1}] : ",i,j);
arr1[i,j] = Convert.ToInt32([Link]());
}
}
[Link]("Input elements in the second matrix :\n");
for(i=0;i<r2;i++)
{
for(j=0;j<c2;j++)
{
[Link]("element - [{0}],[{1}] : ",i,j);
brr1[i,j] = Convert.ToInt32([Link]());
}
}
[Link]("\nThe First matrix is :\n");
for(i=0;i<r1;i++)
{
[Link]("\n");
for(j=0;j<c1;j++)
[Link]("{0}\t",arr1[i,j]);
}
[Link]("\nThe Second matrix is :\n");
for(i=0;i<r2;i++)
{
[Link]("\n");
for(j=0;j<c2;j++)
[Link]("{0}\t",brr1[i,j]);
}
//multiplication of matrix
for(i=0;i<r1;i++)
for(j=0;j<c2;j++)
crr1[i,j]=0;
for(i=0;i<r1;i++) //row of first matrix
{
for(j=0;j<c2;j++) //column of second matrix
{
sum=0;
for(k=0;k<c1;k++)
sum=sum+arr1[i,k]*brr1[k,j];
crr1[i,j]=sum;
}}
[Link]("\nThe multiplication of two matrix is : \n");
for(i=0;i<r1;i++) {
[Link]("\n");
for(j=0;j<c2;j++) {
[Link]("{0}\t",crr1[i,j]);
}
} }
[Link]("\n\n");
}}
7) Write a [Link] program for blinking an image.
Public Class Form1
Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link] = True
End Sub
Private Sub Timer1_Tick(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
If [Link] = True Then
[Link] = False
End If
If [Link] = False Then
[Link] = True
End If
End Sub
End Class
8) Write a C# Program to accept and display ‘n’ student’s details such as Roll. No, Name, marks
in three subjects, using class. Display percentage of each student.
using System;
using [Link];
using [Link];
using [Link];
public class Exercise12
{
static void Main(string[] args)
{
double rl,phy,che,ca,total;
double per;
string nm,div;
[Link]("\n\n");
[Link]("Calculate the total, percentage and division to take marks of three
subjects:\n");
[Link]("------------------------------------------------");
[Link]("\n\n");
[Link]("Input the Roll Number of the student :");
rl = Convert.ToInt32([Link]());
[Link]("Input the Name of the Student :");
nm = [Link]();
[Link]("Input the marks of Physics : ");
phy= Convert.ToInt32([Link]());
[Link]("Input the marks of Chemistry : ");
che = Convert.ToInt32([Link]());
[Link]("Input the marks of Computer Application : ");
ca = Convert.ToInt32([Link]());
total = phy+che+ca;
per = total/3.0;
if (per>=60)
div="First";
else
if (per<60&&per>=48)
div="Second";
else
if (per<48&&per>=36)
div="Pass";
else
div="Fail";
[Link]("\nRoll No : {0}\nName of Student : {1}\n",rl,nm);
[Link]("Marks in Physics : {0}\nMarks in Chemistry : {1}\nMarks in Computer
Application : {2}\n",phy,che,ca);
[Link]("Total Marks = {0}\nPercentage = {1}\nDivision = {2}\n",total,per,div);
}}
9) Write a C#.Net application to display the vowels from a given String.
string vowels = "aeiou";
string str = [Link];
char[] ch = [Link]();
foreach (char c in ch)
{
if ([Link]([Link]())) {
[Link]("vowels :-" + [Link]() + "<br/>"); }
else {
[Link]("consonant :- " + [Link]() + "<br/>"); //consonant
} }
10) Write a [Link] program to accept the details of product (PID, PName, expiry_date, price).
Store it into the database and display it on data grid view.
Imports [Link]
Imports [Link]
Public Class Form1
Private Sub Form1_Load(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link]()
[Link](DataSet21, "Prod")
End Sub
Private Sub btnfirst_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link](DataSet21, "Prod").Position = 0
End Sub
Private Sub btnprev_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link](DataSet21, "Prod").Position = [Link](DataSet21,
"Prod").Position - 1
End Sub
Private Sub btnnext_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link](DataSet21, "Prod").Position = [Link](DataSet21,
"Prod").Position + 1
End Sub
Private Sub btnlast_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link](DataSet21, "Prod").Position = [Link](DataSet21,
"Prod").Count - 1
End Sub
11) Write a [Link] program to accept a number from user through input box and display its
multiplication table into the list box.
Public Class MultiplTable
Dim n, i, ans As Integer
Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
i=1
ans = 1
n = InputBox("Enter Number:")
While i <= 10
ans = n * i
[Link](ans)
i=i+1
End While
End Sub
Private Sub Button2_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link]()
End Sub
End Class
12) Write a [Link] program to create player table (PID, PName, Game, no_of_matches). Insert
records and update number of matches of ‘Rohit Sharma’ and display result in data grid view.
Imports [Link]
Imports [Link]
Public Class Form1
Dim con As New OleDbConnection("Provider = [Link].4.0;data
Source=D:\sym\[Link]\[Link]")
Dim cmd As New OleDbCommand
Dim ad As New OleDbDataAdapter
Dim ds As New DataSet
Private Sub btnInsert_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link]()
[Link] = con
[Link] = "insert into game values (" & [Link] & ",'" & [Link]
& "','" & [Link] & "', " & [Link] & ")"
[Link]()
MsgBox("Record inserted succesfully")
[Link]()
End Sub
Private Sub btnupdate_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link]()
[Link] = con
[Link] = "update game set [Link]=" & [Link] & " where
[Link]='Rohit Sharma' "
[Link]()
MsgBox("Record updated succesfully")
[Link]()
End Sub
13) Write a program in C# to create a function to swap the values of two integers.
using System;
public class funcexer6
{
public static void interchange(ref int num1, ref int num2)
{
int newnum;
newnum = num1;
num1 = num2;
num2 = newnum;
}
public static void Main()
{
int n1,n2;
[Link]("\n\nFunction : To swap the values of two integer numbers :\n");
[Link]("----------------------------------------------------------\n");
[Link]("Enter a number: ");
n1= Convert.ToInt32([Link]());
[Link]("Enter another number: ");
n2= Convert.ToInt32([Link]());
interchange( ref n1, ref n2 );
[Link]( "Now the 1st number is : {0} , and the 2nd number is : {1}", n1,
n2 );
}
}
14) Write a [Link] program to design the following form; it contains the three menus Color
(Red, Blue, and Green), Window (Maximize, Minimize, and Restore) and Exit. On Selection of
any menu or submenu result should affect the form control( for example if user selected Red
color from Color menu back color of form should get changed to Red and if user selected
Maximize from Window Menu then form should get maximized).
Public Class menuprg
Private Sub RedToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub GreenToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub BlueToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub NormalToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub MinimisedToolStripMenuItem_Click(ByVal sender As [Link], ByVal e
As [Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub MaximisedToolStripMenuItem_Click(ByVal sender As [Link], ByVal e
As [Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
End
End Sub
Private Sub RedToolStripMenuItem1_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub GreenToolStripMenuItem1_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub BlueToolStripMenuItem1_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub NormalToolStripMenuItem1_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub MinimumToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub MaximumToolStripMenuItem_Click(ByVal sender As [Link], ByVal e
As [Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub ExitToolStripMenuItem1_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
End
End Sub
Private Sub menuprg_Click(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
If [Link] = [Link] Then
[Link]()
End If
End Sub
End Class
15) Write a program in C#.Net to create a function to check whether a number is prime or not.
using System;
public class funcexer9
{
public static bool chkprime(int num)
{
for (int i=2; i < num; i++)
if (num %i == 0)
return false;
return true;
}
public static void Main()
{
[Link]("\n\nFunction : To check a number is prime or not :\n");
[Link]("-------------------------------------------\n");
[Link]("Input a number : ");
int n= Convert.ToInt32([Link]());
if (chkprime(n))
[Link](n+" is a prime number");
else
[Link](n+" is not a prime number");
}
}
16) Write a [Link] program to create Author table (aid, aname, book_ name). Insert the
records (Max 5). Delete a record of author who has written “[Link] book” and display
remaining records on the data grid view. (Use MS Access to create db.)
Imports [Link]
Imports [Link]
Public Class Form1
Dim con As New OleDbConnection("Provider = [Link].4.0;data
Source=D:\sym\[Link]\CRYST\crystdel\[Link]")
Dim cmd As New OleDbCommand
Dim ad As New OleDbDataAdapter
Dim ds As New DataSet
Dim rd As OleDbDataReader
Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link]()
[Link] = con
[Link] = "insert into book values(" & [Link] & " ,'" & [Link]
& "','" & [Link] & "')"
[Link]()
MsgBox("Record inserted succesfully")
[Link]()
End Sub
Private Sub Button2_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link]()
[Link] = con
[Link] = "delete from book where bname='vb'"
[Link]()
MsgBox("Records deleted succesfully")
[Link]()
End Sub
17) Write a [Link] program to design following screen, accept the details from the
user. Clicking on Submit button Net Salary should be calculated and displayed into the
Textbox. Display the Messagebox informing the Name and Net Salary of employee.
Public Class EmpProf
Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link] = Val([Link]) + (Val([Link]) + Val([Link]) - Val([Link]) +
Val([Link]) + Val([Link]) - Val([Link]))
MsgBox([Link] + " " + [Link])
End Sub
End Class
18) Write a [Link] program to accept the details Supplier (SupId, SupName, Phone
No, Address) store it into the database and display it.
Imports [Link]
Imports [Link]
Public Class Form1
Private Sub Form1_Load(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link]()
[Link](DataSet21, "Sup")
End Sub
Private Sub btnfirst_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link](DataSet21, "Sup").Position = 0
End Sub
Private Sub btnprev_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link](DataSet21, "Sup").Position = [Link](DataSet21,
"Sup").Position - 1
End Sub
Private Sub btnnext_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link](DataSet21, "Sup").Position = [Link](DataSet21,
"Sup").Position + 1
End Sub
Private Sub btnlast_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link](DataSet21, "Sup").Position = [Link](DataSet21,
"Sup").Count - 1
End Sub
19) Write a [Link] program to accept the details of Employee (ENO, EName Salary) and
store it into the database and display it on gridview control.
Imports [Link]
Imports [Link]
Public Class Form1
Private Sub Form1_Load(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link]()
[Link](DataSet11, "Emp")
End Sub
20) Write a [Link] program to create a table student (Roll No, SName, Class,City). Insert
the records (Max: 5). Update city of students to ‘Pune’ whose city is ‘Mumbai’ and
display updated records in GridView
Imports [Link]
Imports [Link]
Public Class Form1
Dim con As New OleDbConnection("Provider = [Link].4.0;data
Source=D:\sym\[Link]\[Link]")
Dim cmd As New OleDbCommand
Private Sub btnupdate_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link]()
[Link] = con
[Link] = "update stud set [Link]= ‘Pune’ where [Link]='Mumbai' "
[Link]()
MsgBox("Record updated succesfully")
[Link]()
End Sub
21) Write a [Link] program to create teacher table (Tid, TName, subject). Insert the
records (Max:5). Search record of a teacher whose name is “Seeta” and display result.
Imports [Link]
Imports [Link]
Public Class Form1
Private Sub Form1_Load(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link]()
[Link](DataSet21, "Teach")
End Sub
Private Sub btnsearch_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
Dim dv As New DataView([Link]("Teach"))
[Link] = "tname= '" & [Link] & "'"
[Link] = dv
End Sub