1 回答

TA貢獻1797條經驗 獲得超6個贊
你應該定義 int[]activityTimes 作為一個全局變量,把它放在外面
public partial class Form1 : Form
{
string activity;
int activityTime;
bool enteredInt = false;
//initializes variables used to store activities
string activity1 = "";
string activity2 = "";
string activity3 = "";
string activity4 = "";
string activity5 = "";
//intitializes variables used to store activity times
int activityTime1 = 0;
int activityTime2 = 0;
int activityTime3 = 0;
int activityTime4 = 0;
int activityTime5 = 0;
int i;
string[] activities=new string[length];
public Form1()
{
InitializeComponent();
}
}
- 1 回答
- 0 關注
- 172 瀏覽
添加回答
舉報