Hello,
I was wondering if you can supply me with information regarding the following. I have two forms - form A and form B. In form A I must choose two teams using two comboBoxes for each. When I click "Continue" which is a button - I want to be able to use whatever team is chosen in Form B... I can give you the following code that shows you what Ive tried but it does not work... ANY assistence regarding this matter will be much appreciated. :)
This is form A which I want to use in form B
internal ComboBox cBox1 = new ComboBox();
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//WHEN CHOOSING A TEAM THEIR FLAG WILL APPEAR IN THE PANEL
if (comboBox1.SelectedIndex != comboBox2.SelectedIndex)
{
Graphics gR = panel1.CreateGraphics();
comboBox1.SelectedItem = cBox1;
if (cBox1.ToString() == "New Zealand")
{
//DRAW NEW ZEALAND RUGBY LOGO
Image imag = Image.FromFile("NZ.jpg");
gR.DrawImage(imag, new Point(0, 0));
label6.Text = "No. 1";
//listOfTeams.Add(NZ);
}
else if (comboBox1.SelectedIndex == 1)
{
//DRAW SOUTH AFRICA RUGBY LOGO
Image imag = Image.FromFile("SA.jpg");
gR.DrawImage(imag, new Point(0, 0));
label6.Text = "No. 2";
Team SA = new Team();
//listOfTeams.Add(SA);
}
else if (comboBox1.SelectedIndex == 2)
{
//DRAW AUSTRALIA RUGBY LOGO
Image imag = Image.FromFile("AUS.jpg");
gR.DrawImage(imag, new Point(0, 0));
label6.Text = "No. 4";
Team AUS = new Team();
//listOfTeams.Add(AUS);
}
else if (comboBox1.SelectedIndex == 3)
{
//DRAW ARGENTINIAN RUGBY LOGO
Image imag = Image.FromFile("ARG.png");
gR.DrawImage(imag, new Point(0, 0));
label6.Text = "No. 10";
Team ARG = new Team();
//listOfTeams.Add(ARG);
}
}
else
{
//WHEN THE SAME TEAMS ARE SELECTED - PROMT USER TO SELECT/CHOOSE A DIFFERENT TEAM
MessageBox.Show("Select a different team", "Team Selection",MessageBoxButtons.OK, MessageBoxIcon.Asterisk,MessageBoxDefaultButton.Button1);
comboBox1.ResetText();
}
}
And this is form B where I want to use form A's comboBox selections
internal PlayerList SCList = new PlayerList();
int total = 0;
int tryScored = 5;
int penOrDropkick = 3;
int conversionTry = 2;
public int seconds;
public int minutes;
public int hours;
public scoreCard()
{
InitializeComponent();
}
//LOADING THE FORM
private void scoreCard_Load(object sender, EventArgs e)
{
FormA f = new FormB();
Graphics gR = panel1.CreateGraphics();
//IF THE COMBOBOX IN FORM A WAS INDEED "New Zealand" THEN IT WILL DRAW THE FLAG IN THE PANEL
if(f.cBox1.ToString() == "New Zealand")
{
Image imag = Image.FromFile("AUS.jpg");
gR.DrawImage(imag, new Point(0, 0));
}
}
}
Thank you very much.