나는 계속해서 문제가 발생했으며 문제가 무엇인지 확신 할 수 없습니다. Microsoft Visual Studio에서 radioButton1은 연속적인 숫자의 합을 찾는 프로그램을 만들고 radioButton2는 숫자의 계승을 찾는 프로그램입니다.라디오 버튼과 for 루프가있는 If-else 문
FOR 루프, WHILE 루프 및 DO-WHILE 루프의 세 버튼이 있습니다. 나는 FOR 버튼으로 일하고있다.
내가하려는 것은 선택을 한 다음 버튼 중 하나를 누르면 메시지 상자에서 클릭 한 루프를 사용하여 답을 찾을 수 있습니다.
이
는 내가 지금까지 들어 왔 것입니다 :"radioButton2.CheckedChanged 'Lab5'does가 정의를 포함하지' '없이 확장 방법 :이 메시지를 수신 계속
private void button1_Click(object sender, System.EventArgs e)
{
if ((radioButton1.Checked == true) && (radioButton2.Checked == false))
{
int sum = 0;
int number = int.Parse(numericUpDown1.Value.ToString());
for (int i = 1; i <= number; i++)
{
sum = sum + i;
MessageBox.Show("The sum of the consecutive numbers leading up to " + number + " is " + sum + ".");
}
MessageBox.Show("The sum of the consecutive numbers leading up to " + number + " is " + sum + ".");
}
else if ((radioButton2.Checked == true) && (radioButton1.Checked == false))
{
int product = 1;
int number = int.Parse(numericUpDown1.Value.ToString());
for (int i = 1; i <= number; i++)
{
product *= i;
MessageBox.Show("The factorial of the numbers leading up to " + number + " is " + product + ".");
}
MessageBox.Show("The factorial of the numbers leading up to " + number + " is " + product + ".");
}
else
{
MessageBox.Show("Invalid");
}
}
'radio5utton2.CheckChanged' 'Lab5'유형의 첫 번째 인수를 수락 할 수 있습니다 (사용 지시문이나 어셈블리 참조가 누락 되었습니까?). "
그리고 나는 솔직히 그게 무슨 뜻인지 전혀 몰라.
도움을 주시면 감사하겠습니다.
radioButton2가 선택되었을 때 radioButton1에 대한 메시지 상자가 나타나지 않기 때문에 if-else 문에 그대로 유지하고 싶습니다.
오류 메시지에서 언급 한 위 코드 중 어떤 행을 언급합니까? 이것이 의미하는 바는 기본적으로 어딘가에'Lab5.CheckedChanged (...) '처럼 보이는 메소드 호출을 가지고 있지만'Lab5' (뭐든간에)는 CheckedChanged 메소드를 가지고 있지 않습니다. –
나는 그것이 aspx 파일의 클라이언트 코드에서 발생한다고 확신한다. 'RadioButton' 태그로 HTML 코드를 보여 주시겠습니까? –
당신은 컨트롤 이름을 부여해야합니다 –