Dot Net Program Solved Slips
Dot Net Program Solved Slips
a=a+1
TextBox1.Text = a.ToString()
End Sub
End Class
Imports System.Data.SqlClient
Public Class Form1
Dim cn As New SqlConnection
Dim cmd As New sqlcommand
Dim datadapter As New sqlDataAdapter
2.1. Write a Vb.Net program to move the Text “Pune University” continuously
from Left to Right and Vice Versa.
2.2 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.
Slip no 3
3.1 Write a program in C# .Net to create a function for the sum of two numbers.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication7
{
class Program
{
public static int Sum(int num1, int num2)
{
int total;
total = num1 + num2;
return total;
}
static void Main(string[] args)
{
Console.Write("\n\nFunction to calculate the sum of two numbers :\n");
Console.Write("--------------------------------------------------\n");
Console.Write("Enter a number: ");
int n1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter another number: ");
int n2 = Convert.ToInt32(Console.ReadLine());
int n3 = Sum(n1, n2);
Console.WriteLine("\nThe sum of two numbers is : {0}\n",n3.ToString());
Console.WriteLine("press any key to exit...");
Console.ReadKey();
}
}
}
Me.Close()
End Sub
Me.BackColor = Color.Red
End Sub
Private Sub BlueToolStripMenuItem_Click(sender As Object, e As
EventArgs) Handles BlueToolStripMenuItem.Click
Me.BackColor = Color.Blue
End Sub
Me.BackColor = Color.Green
End Sub
Me.Close()
End Sub
Me.WindowState = FormWindowState.Maximized
End Sub
Private Sub MinimizedToolStripMenuItem_Click(sender As Object, e As
EventArgs) Handles MinimizedToolStripMenuItem.Click
Me.WindowState = FormWindowState.Minimized
End Sub
Me.WindowState = FormWindowState.Normal
End Sub
End Class
Output:-
Design:-
1) Take MenuStrip on Design form.
2) Write all options on MenuStrip.
Slip no 4
4.1. Design a VB.net form to pick a date from DateTimePicker Control and
display day, month and year in separate text boxes.
B) 4.2 Write C# program to make a class named Fruit with a data member to
calculate thenumber 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 fruits in the basket.
namespace FruitBasket
{
using System;
/// Abstract Fruit class (using as basket)
class Fruit
{
public Apple()
{
NumberOfApples++; // increase number of apples
NumberOfFruits++; // increase number of fruits in basket
}
public Mango()
{
NumberOfMangoes++; // increase number of mangoes
NumberOfFruits++; // increase number of fruits in basket
}
Output
The output of the above program is given as follows.
Matrix a:
1 4 2
2 5 1
Matrix b:
3 4 2
3 5 7
1 2 1
The product of the two matrices is :
172832
223540
Slip no 6
A) Design a VB.net form to pick a date from DateTimePicker Control and display
day,month and year in separate text boxes.
Slip no 7
A) Write a Menu driven program in C#.Net to perform following functionality:
Addition, Multiplication, Subtraction, Division.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace program
class Program
Console.Write("\n\n");
Console.Write("------------------------------------------------");
Console.Write("\n\n");
num1 = Convert.ToInt32(Console.ReadLine());
num2 = Convert.ToInt32(Console.ReadLine());
Console.Write("1-Addition.\n2-Substraction.\n3-Multiplication.\n4-
Division.\n5-Exit.\n");
Console.Write("\nInput your choice :");
opt = Convert.ToInt32(Console.ReadLine());
switch (opt)
case 1:
Console.Write("The Addition of {0} and {1} is: {2}\n", num1, num2, (num1 +
num2));
break;
case 2:
break;
case 3:
break;
case 4:
if (num2 == 0)
}
else
break;
case 5:
break;
default:
break;
Console.ReadKey();
B) Write a C#.Net program to create a base class Department and derived classes
Sales andHuman Resource. Accept the details of both departments and display
them in proper format
Refer slip no 2
Slip no 8
a) Write a Menu driven program in C#.Net to perform following functionality:
Addition, Multiplication, Subtraction, Division.
Refer slip no 7
b) Write C# program to make a class named Fruit with a data member to calculate
thenumber 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 fruits in the basket
namespace FruitBasket
{
using System;
public Mango()
{
NumberOfMangoes++; // increase number of mangoes
NumberOfFruits++; // increase number of fruits in basket
}
Slip no 10
a) Write a program that demonstrates the use of primitive data
types in C#. The program should also support the type conversion
of :
● Integer to String
● String to Integer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace program
class Program
if (typeof(int).IsPrimitive == true)
else
{
Console.WriteLine("Not a primitive data type");
if (typeof(float).IsPrimitive == true)
else
}
// Check the int is an primitiva or not
if (typeof(double).IsPrimitive == true)
else
int i = 12;
double d = 765.12;
float f = 56.123F;
Console.WriteLine(Convert.ToInt32(d));
Console.WriteLine(Convert.ToUInt32(f));
Console.WriteLine(Convert.ToDouble(i));
Console.ReadKey();
b) 10.2 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 theTextbox. Display the Messagebox informing the Name and Net Salary of
employee.
Public Class Form1
End Sub
End Class
Design:-
1) Get Picturbox and timer control on design form.
2) Make timer control Enabled=True
3) Insert image on Picturebox
4) To fit the image PictureBox set Sizemode property to StretchImage
11.2 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 fruits in the basket.
namespace FruitBasket
{
using System;
public Apple()
{
NumberOfApples++; // increase number of apples
NumberOfFruits++; // increase number of fruits in basket
}
public Mango()
{
NumberOfMangoes++; // increase number of mangoes
NumberOfFruits++; // increase number of fruits in basket
}
using System;
string str;
int l=0;
Console.Write("------------------------------------------------------\n");
str = Console.ReadLine();
l++;
Console.Write("\n\n");
}
using System;
Sample Output:
Sample Output:
Slip no 14
A) Write a program in C#.Net to find the sum of all elements of the array
using System;
using System.Linq;
using System;
int sum = 0;
Array.ForEach(array, i => sum += i);
Console.WriteLine(sum);
}
}
class students
string name;
int Rno;
name = Console.ReadLine();
Rno = Convert.ToInt32(Console.ReadLine());
math = Convert.ToDouble(Console.ReadLine());
sci = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("------------------------------------------\n\n");
class Program
int i;
int n = Convert.ToInt32(Console.ReadLine());
for(i=0;i<=n;i++)
s.data();
Console.ReadKey();
Slip no 15
a) Write a C#.Net application to display the vowels from a given String.
using System;
class funcexer8
{
public static int Fibo(int nno)
int num1 = 0;
int num2 = 1;
num1 = num2;
return num1;
Console.Write("------------------------------------------------------------\n");
int n= Convert.ToInt32(Console.ReadLine());
{
Console.Write(Fibo(i)+" ");
Console.WriteLine();
Copy
Sample Output: