Search This Blog

Sunday 5 February 2017

WAP to display Welcome to SCET in message box when you click on SCET button. B. WAP to accept your name in textbox and display it using message box. C. WAP to accept your Name, City in text box and display it in label when you click on Display button. Add two more buttons Clear & Close and implement accordingly.

Practical 2 - A

Form1.cs

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Prac21
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
             MessageBox.Show("HI This is Gajjar");
        }

    }
}
Form2.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Prac21
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Hi, " + textBox1.Text);
        }
    }
}

Form3.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Prac21
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }
        private void btndisplay_Click(object sender, EventArgs e)
        {
            if (txtname.Text.Equals("") || txtcity.Text.Equals(""))
            {
                MessageBox.Show("Plz Enter All Details");
            }
            else {
                lblname.Text = txtname.Text;
                lblcity.Text = txtcity.Text;
            }
        }
        private void btnclear_Click(object sender, EventArgs e)
        {
            lblcity.Text = "";
            lblname.Text = "";
            txtcity.Text = "";
            txtname.Text = "";
        }
        private void btnclose_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}

No comments:

Post a Comment