checkBox,radioButton,groupBox in C#
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 personel_details
{
public partial class Personel : Form
{
public Personel()
{
InitializeComponent();
}
private void btnGenerate_Click(object sender, EventArgs e)
{
string gender;
string hobby="";
if(rbMan.Checked)
gender=rbMan.Text;
else
gender=rbWoman.Text;
if (checkBox1.Checked)
hobby += checkBox1.Text + Environment.NewLine;
if (checkBox2.Checked)
hobby += checkBox2.Text + Environment.NewLine;
if (checkBox3.Checked)
hobby += checkBox3.Text + Environment.NewLine;
if (checkBox4.Checked)
hobby += checkBox4.Text + Environment.NewLine;
if (checkBox5.Checked)
hobby += checkBox5.Text + Environment.NewLine;
if(hobby=="")
hobby = "no hobbies" + Environment.NewLine;
txtInfo.Text = "First Name: " + txtFirst.Text + Environment.NewLine +
"Last Name: " + txtLast.Text + Environment.NewLine +
"Age: "+txtAge.Text+Environment.NewLine+
"Gender: " + gender + Environment.NewLine +
"Hobbies: " +Environment.NewLine+ hobby+ Environment.NewLine ;
}
}
}