Practical Slip
Practical Slip
PRACTICAL SLIP
SLIP NO 1
A) Write a VB.Net Program to display the numbers continuously in TextBox by
clicking on Button.
Answer :
TextBox1.Text = Second(DateTime.Now)
End Sub
Timer1.Enabled = True
Timer1.Interval = 1000
Timer1.Start()
End Sub
End Class
Output :
B) Write a VB.Net program to accept the details of Employee (ENO, EName Salary)
Answer :
Imports System
Imports System.Data
Imports System.Data.OleDb
adpt.Fill(ds, "Emp")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "Emp"
Return ds
End Function
display()
End Sub
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "insert into Emp values(" & TextBox1.Text & ",'" &
TextBox2.Text & "'," & TextBox3.Text & ")"
con.Open()
cmd.ExecuteNonQuery()
con.Close()
ds.Clear()
display()
End Sub
End Class
Output :
SLIP NO 2
A) Write a Vb.Net program to move the Text “Pune University” continuously from Left
Answer :
Label1.Left = -100
Else
Label1.Left = Label1.Left + 10
End If
End Sub
End Class
Output :
B)Write a C#.Net program to create a base class Department and derived classes Sales and
Human Resource. Accept the details of both departments and display them in proper
format.
Answer :
Output :
SLIP NO 3
A) Write a program in C# .Net to create a function for the sum of two numbers.
Answer :
namespace WinFormsApp18
public Form1()
InitializeComponent();
return a + b;
label5.Text = c.ToString();
Output :
B) Write a VB.NET 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.
Answer :
Imports System
Imports System.Data
Imports System.Data.OleDb
adpt.Fill(ds, "teacher")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "teacher"
Return ds
End Function
display()
End Sub
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "insert into teacher values(" & TextBox1.Text & ",'" &
TextBox2.Text & "','" & TextBox3.Text & "')"
con.Open()
If cmd.ExecuteNonQuery() Then
MessageBox.Show("Inserted Successfully...!")
End If
con.Close()
ds.Clear()
display()
End Sub
ds.Clear()
DataGridView1.DataSource = ds
DataGridView1.DataMember = "search"
End Sub
End Class
Output :
SLIP NO 4
A) Design a VB.net form to pick a date from DateTimePicker Control and display day,
Answer :
End Sub
End Class
Output :
B) Create a web application to insert 3 records inside the SQL database table having
following fields ( DeptId, DeptName, EmpName, Salary). Update the salary for any one
employee and increment it to 15% of the present salary. Perform delete operation on
Answer :
Output :
SLIP NO 5
A) Write a VB.NET program to accept a character from keyboard and check whether it
Answer :
Dim a As Char
a = TextBox1.Text
If (TextBox1.Text.Length <= 1) Then
If Char.IsUpper(a) Then
Else
End If
Else
End If
End If
End Sub
Dim a As String
a = TextBox1.Text
Else
Label2.Text = ""
End If
End Sub
End Class
Output :
B) Design a web application form in ASP.Net having loan amount, interest rate and
duration fields. Calculate the simple interest and perform necessary validation i.e.
Ensures data has been entered for each field. Checking for non-numeric value. Assume
Answer :
Output :
SLIP NO 6
A) Write ASP.Net program that displays the names of some flowers in two columns.
Bind a label to the RadioButtonList so that when the user selects an option from the list
and clicks on a button, the label displays the flower selected by the user.
Answer :
Output :
Director). Insert the records (Max: 5). Delete the records of movies whose release year
Answer :
Imports System
Imports System.Data
Imports System.Data.OleDb
adpt.Fill(ds, "movie")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "movie"
Return ds
End Function
display()
End Sub
Private Sub Button1_Click(sender As Object,
e As EventArgs) Handles Button1.Click
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "insert into movie values('" & TextBox1.Text & "'," &
TextBox2.Text & ",'" & TextBox3.Text & "')"
con.Open()
If cmd.ExecuteNonQuery() Then
MessageBox.Show("Inserted Successfully...!")
End If
con.Close()
ds.Clear()
display()
End Sub
cmd.Connection = con
cmd.CommandType = CommandType.Text
con.Open()
If cmd.ExecuteNonQuery() Then
MessageBox.Show("Deleted Successfully...!")
End If
con.Close()
ds.Clear()
display()
End Sub
End Class
Output :
SLIP NO 7
A) Write a ASP.Net program to accept a number from the user in a textbox control and
throw an exception if the number is not a perfect number. Assume suitable controls on
Answer :
Output :
B) Write a VB.NET 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.
Answer :
Output :
SLIP NO 8
selected or all records from listbox to Textbox (assume multi-line property of textbox is
true).
Answer :
Output :
Answer :
Output :
SLIP NO 9
Answer :
namespace WinFormsApp18
public Form1()
{
InitializeComponent();
int a = Convert.ToInt32(textBox1.Text);
int b = Convert.ToInt32(textBox2.Text);
int c = a+b;
label3.Text = "+";
label5.Text = c.ToString();
int a = Convert.ToInt32(textBox1.Text);
int b = Convert.ToInt32(textBox2.Text);
int c = a - b;
label3.Text = "-";
label5.Text = c.ToString();
int a = Convert.ToInt32(textBox1.Text);
int b = Convert.ToInt32(textBox2.Text);
int c = a / b;
label3.Text = "/";
label5.Text = c.ToString();
int a = Convert.ToInt32(textBox1.Text);
int b = Convert.ToInt32(textBox2.Text);
int c = a * b;
label3.Text = "*";
label5.Text = c.ToString();
Output :
B) Create an application in ASP.Net that allows the user to enter a number in the
textbox named "getnum". Check whether the number in the textbox "getnum" is
palindrome or not. Print the message accordingly in the label control named lbldisplay
Answer :
Output :
SLIP NO 10
A) Write a program that demonstrates the use of primitive data types in C#. The
● Integer to String
● String to Integer
Answer :
namespace WinFormsApp19
public Form1()
InitializeComponent();
{
int num = Convert.ToInt32(textBox1.Text);
Output :
B) Write ASP.Net program to connect to the master database in SQL Server in the
Page_Load event. When the connection is established, the message “Connection has
Answer :
Output :
SLIP NO 11
A) Write a ASP.Net program that gets user input such as the user name, mode of
payment, appropriate credit card. After the user enters the appropriate values the
Answer :
Output :
B) Write C# program to make a class named Fruit with a data member to calculate the
number of fruits in a basket. Create two other class named Apples and Mangoes to
calculate the number of apples and mangoes in the basket. Display total number of
Answer :
Output :
SLIP NO 12
A) Write ASP.Net program that displays a button in green color and it should change
Answer :
Output :
no_of_matches). Insert records and update number of matches of ‘Rohit Sharma’ and
Answer :
Imports System
Imports System.Data
Imports System.Data.OleDb
adpt.Fill(ds, "player")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "player"
Return ds
End Function
display()
End Sub
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "insert into player values(" & TextBox1.Text & ",'" &
TextBox2.Text & "','" & TextBox3.Text & "'," & TextBox4.Text & ")"
con.Open()
If cmd.ExecuteNonQuery() Then
MessageBox.Show("Inserted Successfully...!")
End If
con.Close()
ds.Clear()
display()
End Sub
cmd.Connection = con
cmd.CommandType = CommandType.Text
con.Open()
If cmd.ExecuteNonQuery() Then
MessageBox.Show("Updated Successfully...!")
End If
con.Close()
con.Close()
ds.Clear()
display()
End Sub
End Class
Output :
SLIP NO 13
A) Write a VB.net program for blinking an image.
Answer :
If PictureBox1.Visible Then
PictureBox1.Visible = False
Else
PictureBox1.Visible = True
End If
End Sub
Timer1.Enabled = True
Timer1.Interval = 1000
Timer1.Start()
End Sub
End Class
Output :
B) 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.
Answer :
Output :
SLIP NO 14
A) Write a VB.net program for blinking an image.
Answer :
If PictureBox1.Visible Then
PictureBox1.Visible = False
Else
PictureBox1.Visible = True
End If
End Sub
Timer1.Enabled = True
Timer1.Interval = 1000
Timer1.Start()
End Sub
End Class
Output :
B) 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.
Answer :
Output :
SLIP NO 15
A) Write ASP.Net application to create a user control that contains a list of colors. Add
a button to the Web Form which when clicked changes the color of the form to the
Answer :
Me.BackColor = Color.Red
End Sub
Private Sub GreenToolStripMenuItem_Click(sender As Object,
e As EventArgs) Handles GreenToolStripMenuItem.Click
Me.BackColor = Color.Green
End Sub
Me.BackColor = Color.Blue
End Sub
End Class
Output :
B) Write a C#.Net Program to accept and display ‘n’ customer’s details such as
customer_no, Name, address ,itemno, quantity price . Display total price of all item.
Answer :
Output :
SLIP NO 16
A) Write ASP.Net program to create a user control that receives the user name and
password from the user and validates them. If the user name is "DYP" and the password
Answer :
Output :
B) Define a class supplier with fields – sid, name, address, pincode. Write a C#.Net
Output :
SLIP NO 17
Answer :
namespace WinFormsApp21
public Form1()
InitializeComponent();
switch (chars[i])
listBox1.Items.Add(chars[i].ToString());
break;
case 'E' or 'e':
listBox1.Items.Add(chars[i].ToString());
break;
listBox1.Items.Add(chars[i].ToString());
break;
listBox1.Items.Add(chars[i].ToString());
break;
listBox1.Items.Add(chars[i].ToString());
break;
Output :
B) Write a VB.NET program to accept the details of product (PID, PName,
expiry_date, price). Store it into the database and display it on data grid view.
Answer :
Imports System
Imports System.Data
Imports System.Data.OleDb
adpt.Fill(ds, "product")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "product"
Return ds
End Function
display()
End Sub
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "insert into product values(" & TextBox1.Text & ",'" &
TextBox2.Text & "','" & DateTimePicker1.Value & "'," & TextBox4.Text & ")"
con.Open()
If cmd.ExecuteNonQuery() Then
MessageBox.Show("Inserted Successfully...!")
End If
con.Close()
ds.Clear()
display()
End Sub
End Class
Output :
SLIP NO 18
A) Write a VB.NET program to accept a number from user through input box and
Answer :
Dim a As Integer
Dim a As Integer
a = TextBox1.Text
For b = 1 To 10
ListBox1.Items.Add(a * b)
Next
Console.ReadLine()
End Sub
End Class
Output :
• ListBox
• Button
• Image
• Label
The listbox is used to list items available in a store. When the user clicks on an
item in the listbox, its image is displayed in the image control. When the user clicks the
Answer :
Output :
SLIP NO 19
Answer :
str = TextBox1.Text
rev = StrReverse(str)
If (str = rev) Then
Else
End If
End Sub
End Class
Output :
Provide a VOTE button. After user votes, present the result in percentage using labels
Answer :
Output :
SLIP NO 20
Answer :
TreeView1.Nodes.Add("Master")
TreeView1.Nodes(0).Nodes.Add("Student Details")
TreeView1.Nodes(0).Nodes.Add("Teacher Details")
TreeView1.Nodes.Add("Examination")
TreeView1.Nodes(1).Nodes.Add("Internal Exam")
TreeView1.Nodes(1).Nodes.Add("External Exam")
TreeView1.Nodes(1).Nodes.Add("Practical Exam")
End Sub
End Class
Output :
redirects the user to a custom error page. All the above should be done with the trace
Answer :
Output :
SLIP NO 21
A) Write a VB.NET program to accept sentences in text box and count the number of
Answer :
str = TextBox1.Text
For I = 0 To arr.Length - 1
Count = Count + 1
End If
Next
End Sub
End Class
Output :
2. Insert a Record.
3. Update a record
Answer :
Output :
SLIP NO 22
Answer :
Output :
B) Write a Vb.net 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).
Answer :
Me.BackColor = Color.Red
End Sub
Me.BackColor = Color.Green
End Sub
End Sub
Me.WindowState = FormWindowState.Maximized
End Sub
Me.WindowState = FormWindowState.Minimized
End Sub
Me.WindowState = FormWindowState.Normal
End Sub
End Class
Output :
SLIP NO 23
sequence.
Answer :
namespace WinFormsApp22
public Form1()
InitializeComponent();
a = Convert.ToInt32(textBox1.Text);
listBox1.Items.Add(b);
listBox1.Items.Add(c);
d = b + c;
listBox1.Items.Add(d);
b = c;
c = d;
Output :
B) Create the application in ASP.Net that accepts name, password ,age , email id, and
user id. All the information entry is compulsory. Password should be reconfirmed. Age
should be within 21 to 30. Email id should be valid. User id should have at least a
capital letter and digit as well as length should be between 7 and 20 characters.
Answer :
Output :
SLIP NO 24
not.
Answer :
namespace WinFormsApp26
public Form1()
InitializeComponent();
int b = a/2;
{
if(a % 2 == 0)
isprime = false;
break;
if (isprime)
else
MessageBox.Show(prime(Convert.ToInt32(textBox1.Text)));
Output :
B) Write a VB.NET program to create Author table (aid, aname, book_ name). Insert the
records (Max 5). Delete a record of author who has written “VB.NET book” and
display remaining records on the data grid view. (Use MS Access to create db.)
Answer :
Imports System.Data.OleDb
adpt.Fill(ds, "Author")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "Author"
Return ds
End Function
display()
End Sub
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "insert into Author values(" & TextBox1.Text & ",'" &
TextBox2.Text & "','" & TextBox3.Text & "')"
con.Open()
If cmd.ExecuteNonQuery() Then
MessageBox.Show("Inserted Successfully...!")
End If
con.Close()
ds.Clear()
display()
End Sub
cmd.Connection = con
cmd.CommandType = CommandType.Text
con.Open()
If cmd.ExecuteNonQuery() Then
MessageBox.Show("Deleted Successfully...!")
End If
con.Close()
ds.Clear()
display()
End Sub
End Class
Output :
SLIP NO 25
A) Write a program in C#.Net to create a function to calculate the sum of the individual
digits of a given number.
Answer :
Output :
B) Create a Web Application in ASP.Net to display all the Empname and Deptid of the
employee from the database using SQL source control and bind it to GridView.
Create Table Alter Table Drop Table Type Your DDL Query Here
Answer :
Output :
SLIP NO 26
A). Write a program in C#.Net to create a recursive function to find the factorial of a
given number
Answer :
Output :
B) Write a ASP.Net program to create a Login Module which adds Username and
Answer :
Output :
SLIP NO 27
Answer :
namespace WinFormsApp24
public Form1()
InitializeComponent();
int a = textBox1.Text.Length;
Output :
B) Create a web application in ASP.Net which may have a textbox. Now user must type
some data into it, the data he can enter is only 255 characters. After he crosses the limit
then the last word should not by typed and at the same time color of textbox
should be red.
Answer :
Output :
SLIP NO 28
order.
Answer :
namespace WinFormsApp23
public Form1()
InitializeComponent();
listBox1.Items.Add(textBox1.Text);
listBox2.Items.Clear();
listBox2.Items.Add (listBox1.Items[i]);
Output :
B) Write a VB.NET program to create a table Patient (PID, PName, Contact No,
Disease). Insert five records into table and display appropriate message in message box.
Answer :
Output :
SLIP NO 29
Answer :
using System;
class Program {
Console.ReadLine();
Output :
B) Write a VB.NET program to accept the details of customer (CName, Contact No,
Email_id). Store it into the database with proper validation and display appropriate
Answer :
Imports System.Data.SqlClient
Return
End If
Return
End If
Return
End If
command.Parameters.AddWithValue("@CName", cname)
command.Parameters.AddWithValue("@ContactNo", contactNo)
command.Parameters.AddWithValue("@Email", email)
connection.Open()
connection.Close()
Else
End If
End Using
End Sub
End Class
Output :
SLIP NO 30
A) Write a VB.NET 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.
Answer :
End Sub
End Sub
End Class
Output :
B) Write a VB.NET program to accept the details Supplier (SupId, SupName, Phone
Answer :
Imports System.Data.OleDb
adpt.Fill(ds, "Supplier")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "Supplier"
Return ds
End Function
display()
End Sub
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "insert into Supplier values(" & TextBox1.Text & ",'" &
TextBox2.Text & "'," & TextBox3.Text & ",'" & TextBox4.Text & "')"
con.Open()
If cmd.ExecuteNonQuery() Then
MessageBox.Show("Inserted Successfully...!")
End If
con.Close()
ds.Clear()
display()
End Sub
End Class
Output :