Click here to Skip to main content
15,125,657 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Help Plz

Form3
<pre lang="c#">[CODE]
private void SampSecUygula_Click(object sender, EventArgs e)
        {
            SampiyonAdı.Text = "Sampiyon Adi : " + Program.SampiyonAdi;
            SampiyonaAitRunleriOku(Program.SampiyonAdi);
            for (int i = 0; i < 141; i++)
            {
                if (Program.SampiyonAdi == Sampiyonlar)
                {
                    Console.WriteLine(sender.ToString()+e.ToString());
                    Console.WriteLine(SampiyonRes);
                    SampiyonSecici.Image = (Image)Properties.Resources.ResourceManager.GetObject(SampiyonRes[4]); // this line
                }
            }
        }
[/CODE]

Clicking on the button will work fine, but it will not work if you call it from another form -> (Image)Properties.Resources.ResourceManager.GetObject(SampiyonRes[4]); only this code does not work

Form4
C#
[CODE]
private void btnEvent_Click(object sender, EventArgs e)
        {
            var button = sender as Button;
            if (button != null)
            {
                Form3 frm3 = new Form3();
                frm3.HeroSeciminiUygula();
                this.Hide();
            }
        }
[/CODE]


What I have tried:

I tried same thing over and over time but WORK Properly just click myself.
Posted
Updated 21-Jul-18 10:24am
v2
Comments
Mike V Baker 23-Jul-18 11:57am
   
Your Form4 creates a new Form3. It doesn't call the function that you're trying to run.
BTW your function is making the same comparison 141 times. I would test Program.SampiyonAdi == Sampiyonlar first and then run through the i = 0 to 141 only if that's true.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900