Certainly! It looks like you want a simple GUI form (e.g., in C# Windows Forms) with a combination of color and job selections, then showing a message with the selected values when a "Show" button is clicked.
I'll write you a complete C# Windows Forms example that implements the following:
- A label "Select your Color"
- Radio buttons for Red, Blue, Green
- A label "Select your job"
- Radio buttons for Teacher, Doctor, Developer, Journalist (correcting the typo 'Joumalist')
- A button "Show"
- When clicking Show, it displays a message box with "your Color ___ and your job ___"
Here is the C# Windows Forms code:
using System;
using System.Windows.Forms;
namespace ColorJobSelector
{
public class Form1 : Form
{
private Label lblColor;
private RadioButton rbRed;
private RadioButton rbBlue;
private RadioButton rbGreen;
private Label lblJob;
private RadioButton rbTeacher;
private RadioButton rbDoctor;
private RadioButton rbDeveloper;
private RadioButton rbJournalist;
private Button btnShow;
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
// Form
this.Text = "Color and Job Selector";
this.Width = 300;
this.Height = 350;
// Label Select your Color
lblColor = new Label();
lblColor.Text = "Select your Color";
lblColor.Top = 10;
lblColor.Left = 10;
lblColor.Width = 150;
// RadioButtons for Color
rbRed = new RadioButton();
rbRed.Text = "Red";
rbRed.Top = lblColor.Bottom + 5;
rbRed.Left = 20;
rbBlue = new RadioButton();
rbBlue.Text = "Blue";
rbBlue.Top = rbRed.Bottom + 5;
rbBlue.Left = 20;
rbGreen = new RadioButton();
rbGreen.Text = "Green";
rbGreen.Top = rbBlue.Bottom + 5;
rbGreen.Left = 20;
// Label Select your job
lblJob = new Label();
lblJob.Text = "Select your job";
lblJob.Top = rbGreen.Bottom + 15;
lblJob.Left = 10;
lblJob.Width = 150;
// RadioButtons for Job
rbTeacher = new RadioButton();
rbTeacher.Text = "Teacher";
rbTeacher.Top = lblJob.Bottom + 5;
rbTeacher.Left = 20;
rbDoctor = new RadioButton();
rbDoctor.Text = "Doctor";
rbDoctor.Top = rbTeacher.Bottom + 5;
rbDoctor.Left = 20;
rbDeveloper = new RadioButton();
rbDeveloper.Text = "Developer";
rbDeveloper.Top = rbDoctor.Bottom + 5;
rbDeveloper.Left = 20;
rbJournalist = new RadioButton();
rbJournalist.Text = "Journalist";
rbJournalist.Top = rbDeveloper.Bottom + 5;
rbJournalist.Left = 20;
// Button Show
btnShow = new Button();
btnShow.Text = "Show";
btnShow.Top = rbJournalist.Bottom + 20;
btnShow.Left = 20;
btnShow.Width = 100;
btnShow.Click += BtnShow_Click;
// Add controls to Form
this.Controls.Add(lblColor);
this.Controls.Add(rbRed);
this.Controls.Add(rbBlue);
this.Controls.Add(rbGreen);
this.Controls.Add(lblJob);
this.Controls.Add(rbTeacher);
this.Controls.Add(rbDoctor);
this.Controls.Add(rbDeveloper);
this.Controls.Add(rbJournalist);
this.Controls.Add(btnShow);
}
private void BtnShow_Click(object sender, EventArgs e)
{
string color = "";
if (rbRed.Checked) color = "Red";
else if (rbBlue.Checked) color = "Blue";
else if (rbGreen.Checked) color = "Green";
string job = "";
if (rbTeacher.Checked) job = "Teacher";
else if (rbDoctor.Checked) job = "Doctor";
else if (rbDeveloper.Checked) job = "Developer";
else if (rbJournalist.Checked) job = "Journalist";
if (string.IsNullOrEmpty(color) || string.IsNullOrEmpty(job))
{
MessageBox.Show("Please select a color and a job.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
MessageBox.Show($"Your Color {color} and your job {job}", "Selection", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
}
}
Explanation
- The form contains two groups of radio buttons for color and job selection.
- Once the user clicks "Show" button, the app checks which radio buttons are selected.
- If either color or job is missing, it shows a warning.
- Otherwise, it shows the message: "Your Color and your job ".
If you want me to write the code in a different language or framework, please let me know!