You are on page 1of 3

Create the following form to get students information from different controls and show

in the rich textbox.


Form Design:

1) Add the following controls to the windows form.


2) Place a picture box and the OpenFileDialog from the toolbox.
3) Label all the text boxes with the given data and add the radio buttons on the
form.
4) All the data from the textboxes will be added to the last multiline textbox or
richtextbox.

SOLUTION

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 WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void groupBox1_Enter(object sender, EventArgs e)


{

private void label4_Click(object sender, EventArgs e)


{

private void label3_Click(object sender, EventArgs e)


{

private void richTextBox1_TextChanged(object sender, EventArgs e)


{
}

private void button1_Click(object sender, EventArgs e)


{
String std, fthr, Add, DOB;
std = textBox1.Text;
fthr = textBox2.Text;
DOB = textBox3.Text;
Add = textBox4.Text;

if (radioButton1.Checked == true)
{
richTextBox1.Text = richTextBox1.Text + "gender " + radioButton1.Text +
"\n";
}
else if (radioButton2.Checked == true)
{
richTextBox1.Text = richTextBox1.Text + "Gender " + radioButton2.Text +
"\n";
}
else
{
richTextBox1.Text = "not selected";
}
if (radioButton4.Checked == true)
{
richTextBox1.Text = richTextBox1.Text + "department:" + radioButton4.Text
+ "\n";
}
else if (radioButton5.Checked == true)
{
richTextBox1.Text = richTextBox1.Text + "department:" + radioButton5.Text
+ "\n";
}
else if (radioButton6.Checked == true)
{
richTextBox1.Text = richTextBox1.Text + "department:" + radioButton6.Text
+ "\n";
}
else if (radioButton7.Checked == true)
{
richTextBox1.Text = richTextBox1.Text + "department:" + radioButton7.Text
+ "\n";
}

richTextBox1.Text = ("student " + std + "\nfather name " + fthr + "\nDate


Of Birth " + DOB + "\nAdress" + Add + "\n" + richTextBox1.Text);

private void groupBox2_Enter(object sender, EventArgs e)


{
}

private void openFileDialog1_FileOk(object sender, CancelEventArgs e)


{

private void button3_Click(object sender, EventArgs e)


{
Application.Exit();
}

private void button2_Click(object sender, EventArgs e)


{
richTextBox1.Clear();
}
}

You might also like