Tuesday 16 April 2013

Second Question Show in listview




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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        string cour;
        string gen;
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void BtnSave_Click(object sender, EventArgs e)
        {
            listBox1.Items.Add("Name - "+TxtName.Text);
            listBox1.Items.Add("Roll No - "+TxtRoll.Text);
            //For Gender
            if(RadMale.Checked)
                gen=RadMale.Text;
            else
                gen=RadFemale.Text;
            listBox1.Items.Add("Gender - "+gen.ToString());
            //Gender work over
            ///==================
            //For Course
            if (ChkC.Checked)
                cour = ChkC.Text+",";
            if (ChkCPlus.Checked)
                cour += ChkCPlus.Text + ",";
            if (ChkJava.Checked)
                cour += ChkJava.Text;
            listBox1.Items.Add("Course - " + cour.ToString());
            //Course End
        }
      
    }
}

No comments:

Post a Comment