lab_5 kim sir Department Select
lab_5 kim sir Department Select
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 Nahid_029_Lab6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if(radioButton1.Checked)
{
comboBox1.DataSource = listBox1.Items;
}
if (radioButton2.Checked)
{
comboBox1.DataSource = listBox2.Items;
}
if (radioButton3.Checked)
{
comboBox1.DataSource = listBox3.Items;
}
}
private void button2_Click(object sender, EventArgs e)
{
if(radioButton1.Checked)
{
textBox1.Text = "Faculty: " + radioButton1.Text + Environment.NewLine
+"Department:"+ comboBox1.SelectedItem.ToString();
}
if (radioButton2.Checked)
{
textBox1.Text = "Faculty: " + radioButton2.Text + Environment.NewLine +
"Department:" + comboBox1.SelectedItem.ToString();
}
if (radioButton3.Checked)
{
textBox1.Text = "Faculty: " + radioButton3.Text + Environment.NewLine +
"Department: "+ comboBox1.SelectedItem.ToString();
}
}
}
Output: