Friday, 31 May 2013

Convert Uppercase | Lowercase | Concatenate | Add

Use Text Boxes, Labels and buttons convert Uppercase | Lowercase | Concatenate | Add

The .NET framework is built upon the object-oriented approach. Everything in the .NET framework is a class or an instance of a class. One of the main components of the .NET framework is the class library. Class libraries are collection of reusable classes, or types. These class libraries are sub divided into namespaces, which group the classes according to the services they offer. System is one of the important namespaces defined in the .NET framework. It contains all the fundamental classes and base classes or types that would be commonly used by all applications. System.Windows.Forms is the next important namespace. This namespace contains classes required to create user interfaces. Some of the other namespaces used while creating a user interface are:
Ø  System.Drawing
Ø  System.Collections
Ø  System.ComponentModel
Ø  System.Data

WinForms follow the Object-oriented approach. Different controls or components used to build the user interface in WinForms are available in the form of classes. Some of the classes that are included in the Systems.Windows.Forms namespace are:
Ø  TextBox
Ø  Button
Ø  Label
Ø  ListBox
Ø  ComboBox

Ø  CheckBox

Use Textboxes, Labels and buttons to take two values as input and provide following features:
          Add values and display result
         Concatenate values and display result
        Convert to uppercase the concatenation of two values
     Convert to lowercase the concatenation of two values
Note: Align the controls properly. Ignore error checking code for this lab.

Code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace vp2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void bt1_Click(object sender, EventArgs e)
        {
            int sum;
            sum = int.Parse(textBox1.Text) + int.Parse(textBox2.Text);
            lb1.Text = sum.ToString();
        }

        private void bt2_Click(object sender, EventArgs e)
        {
            lb2.Text = textBox1.Text + textBox2.Text;
        }

        private void bt3_Click(object sender, EventArgs e)
        {
            lb3.Text=lb2.Text.ToUpper();
        }

        private void bt4_Click(object sender, EventArgs e)
        {
            lb4.Text = lb2.Text.ToLower();
        }
     
    }
}

Screen Shot









No comments:

Post a Comment