0% found this document useful (0 votes)
14 views

Using Using Using Using Using Using Using Using Using Namespace Public Partial Class

The document defines a Windows Forms application with two forms. Form1 contains controls like radio buttons and check boxes to collect user input for gender, hobby, and status. It uses this input to call the SetValues method on a new instance of Form2, passing the string values. This allows Form2 to display the collected information from Form1.

Uploaded by

Waleed Mughal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Using Using Using Using Using Using Using Using Using Namespace Public Partial Class

The document defines a Windows Forms application with two forms. Form1 contains controls like radio buttons and check boxes to collect user input for gender, hobby, and status. It uses this input to call the SetValues method on a new instance of Form2, passing the string values. This allows Form2 to display the collected information from Form1.

Uploaded by

Waleed Mughal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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 _3_8_17
{
public partial class Form1 : Form
{

public Form1()
{
InitializeComponent();
}

public partial class Form2 : Form


{
public Form2();

internal void SetValues(string Gender, string Hobby, string Status)


{
throw new NotImplementedException();
}
}

private void button1_Click(object sender, EventArgs e)


{
try
{
String Gender, Hobby, Status = "";

if (radioButton1.Checked) Gender = "Male";


else Gender = "Female";
if (checkBox1.Checked) Hobby = "Reading";
else Hobby = "Painting";
if (radioButton3.Checked) Status = "Married";
else Status = "Unmarried";

Form2 objPreview = new Form2();


objPreview.SetValues(Gender, Hobby, Status);
//label1.Text = textBox1.Text;
objPreview.Show();
}
catch(Exception ex)
{
MessageBox.Show("Message"+ ex.Message);
}

// string a;
// a = comboBox1.SelectedItem.ToString();
// Form2 fr = new Form2();
// fr.Show();

private void Form1_Load(object sender, EventArgs e)


{

private void button2_Click(object sender, EventArgs e)


{
Form2 fr = new Form2();
fr.Show();
}

private void textBox1_TextChanged(object sender, EventArgs e)


{

}
}
}

You might also like