Dot Net Framework
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
Answer :
namespace WinFormsApp19
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int num = Convert.ToInt32(textBox1.Text);
label1.Text = "Before conversion :
" + num.GetType();
String str = Convert.ToString(num);
label2.Text = "After conversion: " + str.GetType();
}
private void button2_Click(object sender, EventArgs e)
{
label1.Text = "Before conversion :
" + textBox1.Text.GetType();
int num = Convert.ToInt32(textBox1.Text);
label2.Text = "After conversion: " + num.GetType();
}
}
}
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
been established” should be displayed in a
label in the form .
Answer :
Output :
No comments:
Post a Comment