-1
저는 텍스트 상자에 질문을 표시하는 프로젝트를 진행하고 있습니다. 그들 각자의 밑에 4 개의 체크 박스가 있고 사용자는 질문에 응답하는 것을 선택해야합니다.사례를 사용하는 대신 텍스트 파일을 읽는 방법은 무엇입니까?
모든 질문, 답변 등을 .txt 파일에 넣고 거기에서로드 할 수있는 방법이 있습니까? 각 질문마다 약 case
을 쓰고 싶지 않습니다 (약 120 개의 질문이 있습니다).
지금까지 그 일을 내 방식 :
은case 5: // Multiple Answers
txtQuestion.Text = "What are the characteristics of the " +
"Main method? (Choose two)";
grpSingleChoice.Visible = false;
grpMultipleChoice.Visible = true;
chkAnswer1.Text = "A. It must always return void";
chkAnswer2.Text = "B. It is always the first method inside the " +
"main class of a program";
chkAnswer3.Text = "C. It is the start and end point of a program";
chkAnswer4.Text = "D. It must always be passed an array of strings " +
"as in static void Main(string[] args)";
chkAnswer5.Visible = true;
chkAnswer5.Text = "E. It must be created inside of a class" +
"or a structure";
break;
더 나은 : 사용 데이터베이스) –
예있다 - 갈을 가지고 우리가 특정 질문을 알려 때문에 너무 광범위 순간에 대답 할 수있는 질문에. 가능한 해결책이 너무 많습니다. – Ian
XML 파일을 고려할 수도 있습니다. "질문"요소와 "대답"요소를 가질 수 있습니다. –