回答編集履歴
1
サンプルコードを追記
    
        answer	
    CHANGED
    
    | 
         @@ -1,3 +1,54 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            > エラー文  名前 's' は現在のコンテキスト内に存在しません。
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            変数「s」が宣言されていないか、宣言している場所が正しくないときに出るエラーですので、ご確認ください。
         
     | 
| 
      
 3 
     | 
    
         
            +
            変数「s」が宣言されていないか、宣言している場所が正しくないときに出るエラーですので、ご確認ください。
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            #### 追記
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Form2 に Form1 の参照を持たせておけば、Form1 の状態を見て Form2 の処理を変えることはできると思います。
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            そもそも、ユーザーに 2 つのフォームを同時に操作させるのはアプリケーションの使い勝手としてどうなのか?という疑問はありますが。
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ```C#
         
     | 
| 
      
 12 
     | 
    
         
            +
            using System;
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            namespace Sample
         
     | 
| 
      
 15 
     | 
    
         
            +
            {
         
     | 
| 
      
 16 
     | 
    
         
            +
                public int S { get; set; }
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                public class Form1
         
     | 
| 
      
 19 
     | 
    
         
            +
                {
         
     | 
| 
      
 20 
     | 
    
         
            +
                    private void timer1_Tick(object sender, EventArgs e)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    {
         
     | 
| 
      
 22 
     | 
    
         
            +
                        c++;
         
     | 
| 
      
 23 
     | 
    
         
            +
                        fm3.label1.Text = r.Next(1, 100).ToString();
         
     | 
| 
      
 24 
     | 
    
         
            +
                        number[s] = Convert.ToInt32(fm3.label1.Text);
         
     | 
| 
      
 25 
     | 
    
         
            +
                        this.S++;
         
     | 
| 
      
 26 
     | 
    
         
            +
                        if (Convert.ToInt32(comboBox1.Text) + 1 == c)
         
     | 
| 
      
 27 
     | 
    
         
            +
                        {
         
     | 
| 
      
 28 
     | 
    
         
            +
                            timer1.Enabled = false;
         
     | 
| 
      
 29 
     | 
    
         
            +
                            fm3.Hide();
         
     | 
| 
      
 30 
     | 
    
         
            +
                            this.S = r.Next(1, c - 1);
         
     | 
| 
      
 31 
     | 
    
         
            +
                            fm2.label1.Text = this.S + "枚目のカードの数字は?";
         
     | 
| 
      
 32 
     | 
    
         
            +
                            fm2.ShowDialog();
         
     | 
| 
      
 33 
     | 
    
         
            +
                        }
         
     | 
| 
      
 34 
     | 
    
         
            +
                    }
         
     | 
| 
      
 35 
     | 
    
         
            +
                }
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                public class Form2
         
     | 
| 
      
 38 
     | 
    
         
            +
                {
         
     | 
| 
      
 39 
     | 
    
         
            +
                    private form1;
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                    public Form2(Form1 form1)
         
     | 
| 
      
 42 
     | 
    
         
            +
                    {
         
     | 
| 
      
 43 
     | 
    
         
            +
                        this.form1 = form1;
         
     | 
| 
      
 44 
     | 
    
         
            +
                    }
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                    private void button1_Click(object sender, EventArgs e)
         
     | 
| 
      
 47 
     | 
    
         
            +
                    {
         
     | 
| 
      
 48 
     | 
    
         
            +
                        if (number[this.form1.S] == Convert.ToInt32(fm2.textBox1.Text))
         
     | 
| 
      
 49 
     | 
    
         
            +
                        {
         
     | 
| 
      
 50 
     | 
    
         
            +
                        }
         
     | 
| 
      
 51 
     | 
    
         
            +
                    }
         
     | 
| 
      
 52 
     | 
    
         
            +
                }
         
     | 
| 
      
 53 
     | 
    
         
            +
            }
         
     | 
| 
      
 54 
     | 
    
         
            +
            ```
         
     |