I have two forms FormA and FormB. Each has combobox prefiled with data from database. I can pass data from each of these box to another formC but I have to comment out a section of the code each time. Is there a way to pass such data(when I click submit button) depending on which form I am working with?
Here is what my code looks like...
FormA(Source)
public static string authcode = "";
private void btnok_Click(object sender, EventArgs e)
{
authcode = cmbselectexam.SelectedItem.ToString();
Questions qs = new Questions();
qs.Show();
this.Hide();
}
FormB(Another source)
public static string setauthcode = "";
setauthcode =txtauthorizationcode.Text;
Questions qs = new Questions();
this.Hide();
qs.Show();
FormC(recepient)
private void Questions_Load(object sender, EventArgs e)
{
//txtauthorizationcode.Text = TestDetails.setauthcode;
txtauthorizationcode.Text = EditQuestions.authcode;
}

Laxmidhar SahooRank #383 · 6.6K reputationPosted Aug 12, 2020, 7:21 PM EDT
Farhan AhmedRank #73 · 25K reputationPosted Aug 12, 2020, 8:00 PM EDT
Jenith ThakkarRank #789 · 2.9K reputationPosted Aug 12, 2020, 8:30 PM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 12, 2020, 8:40 PM EDT
Joel Bwana38 reputationPosted Aug 13, 2020, 1:26 PM EDT
Joel Bwana38 reputationPosted Aug 13, 2020, 1:28 PM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 13, 2020, 6:50 PM EDT
Jenith ThakkarRank #789 · 2.9K reputationPosted Aug 13, 2020, 7:18 PM EDT
Laxmidhar SahooRank #383 · 6.6K reputationPosted Aug 14, 2020, 12:34 AM EDT
Joel Bwana38 reputationPosted Aug 24, 2020, 10:54 AM EDT
Hamid KhanRank #424 · 5.9K reputationPosted Sep 1, 2020, 2:45 AM EDT
Joel Bwana38 reputationPosted Sep 18, 2020, 2:08 AM EDT