I'm trying to pass the string 'IDdateOfBirth' from the class 'ApplicationForm' to 'IDForm' and insert it into a richtextBox but my constructor doesn't seem to be passing it as it still says 'IDdob doesn't exist in current context'
namespace PROG2B_Assign1
{
public partial class ApplicationForm : Form
{
string IDday;
string IDmonth;
string IDyear;
string IDyearRemove;
string IDdateOfBirth;
public ApplicationForm()
{
InitializeComponent();
IDday = Convert.ToString(comboBox2.Text);
IDmonth = Convert.ToString(comboBox2.Text);
IDyear = Convert.ToString(comboBox2.Text);
IDyearRemove = IDyear.Remove(0, 2);
IDdateOfBirth = IDyearRemove + IDmonth + IDday;
}
//Constructor to pass IDdateOfBirth
public ApplicationForm(string IDdob)
{
IDdateOfBirth = IDdob;
}
namespace PROG2B_Assign1
{
public partial class IDForm : Form
{
public IDForm()
{
InitializeComponent();
}
private void GenerateButton_Click(object sender, EventArgs e)
{
ApplicationForm Form = new ApplicationForm(IDdob); // Here is says that it doesn't exist in the current context
richTextBox1.AppendText(IDdateOfBirth); // string I want in the richTextBox of this form
}
}
}